Comparar commits
1 Commits
| Autor | SHA1 | Data | |
|---|---|---|---|
| f182273037 |
@@ -1,6 +1,171 @@
|
||||
CHANGES.txt - 2006-03-24
|
||||
CHANGES.txt - 2006-05-08
|
||||
------------------------
|
||||
|
||||
CHANGES IN CUPS V1.2.0
|
||||
|
||||
- Documentation updates (STR #1618, STR #1620, STR #1622,
|
||||
STR #1637)
|
||||
- Static file copy buffers reduced from 64k to 32k to
|
||||
work around bogus MallocDebug library assumptions (STR
|
||||
#1660)
|
||||
- The scheduler did not decode the backend exit code
|
||||
properly (STR #1648)
|
||||
- The MacOS X USB backend did not report the 1284 device ID,
|
||||
nor did it fix device IDs returned by HP printers.
|
||||
- The scheduler started more slowly than 1.1.x with large
|
||||
numbers of printers (STR #1653)
|
||||
- cupsRasterInterpretPPD() didn't support the
|
||||
cupsPreferredBitsPerColor attribute, and imagetoraster
|
||||
didn't use the new API.
|
||||
- The "make test" script did not create all of the necessary
|
||||
subdirectories for testing (STR #1638)
|
||||
- The scheduler did not prevent rotation of logs
|
||||
redirected to /dev/null (STR #1651)
|
||||
- "make test" did not include the SNMP backend in the
|
||||
test environment (STR #1625)
|
||||
- The EPM packaging files did not work (STR #1621)
|
||||
- "Use Default Configuration" inserted a broken
|
||||
configuration file (STR #1624)
|
||||
- Redirects in the web interface did not always preserve
|
||||
the encrypted status of a connection (STR #1603)
|
||||
- Added the Apple "pap" backend.
|
||||
- Added CUPS library to CUPS Image shared library
|
||||
linkage to support Linux --as-needed linker option
|
||||
(STR #1606)
|
||||
- Fixed support for --enable-pie (STR #1609)
|
||||
- The pdftops filter did not validate the length of the
|
||||
encryption key (STR #1608)
|
||||
- Updated the Polish localization.
|
||||
- "Encryption Required" in the cupsd.conf file now only
|
||||
requires encryption when the connection is not over the
|
||||
loopback interface or domain socket.
|
||||
- Printer names containing "+" were not quoted properly in
|
||||
the web interface (STR #1600)
|
||||
- The SNMP backend now reports the make and model in the
|
||||
information string so that the auto-generated printer
|
||||
name is more useful than just an IP address.
|
||||
|
||||
|
||||
CHANGES IN CUPS V1.2rc3
|
||||
|
||||
- The cups-lpd program always did reverse lookups on the
|
||||
client address, which could be a performance problem.
|
||||
Added a "-n" option to disable lookups.
|
||||
- When configured with SSL support, require encryption by
|
||||
default when displaying the /admin location (STR #1592)
|
||||
- The next job ID was not computed correctly if the job
|
||||
cache file got out of sync with the spool directory
|
||||
(STR #1582)
|
||||
- The PNG image handling code used deprecated functions
|
||||
from libpng (STR #1587)
|
||||
- Added a Polish translation (STR #1584, STR #1586)
|
||||
- More changes to the scheduler to improve battery life
|
||||
on portable devices (STR #1583)
|
||||
- Changed the default log level for status messages back
|
||||
to "DEBUG" to be consistent with CUPS 1.1.x (STR #1579)
|
||||
- The error string was not set properly when
|
||||
cupsDoFileRequest() was given the name of a directory
|
||||
(STR #1578)
|
||||
- Fixed handling of job-hold-until (STR #1581)
|
||||
- Added explicit notes to the cupsaddsmb man page
|
||||
explaining that the driver filenames are case-sensitive
|
||||
under UNIX and that they must be all lowercase (Windows
|
||||
2000) or all UPPERCASE (Windows 95/98/Me) to work (STR
|
||||
#1568)
|
||||
- The USB backend incorrectly split the manufacturer name
|
||||
if it contained spaces (STR #1566)
|
||||
- The scheduler would hang when listing PPD files for a
|
||||
manufacturer whose name contained spaces (STR #1567)
|
||||
- Added the SNMP backend for network printer discovery
|
||||
(STR #1555)
|
||||
- cupstestppd now fails PPD files with 1284DeviceId
|
||||
instead of 1284DeviceID, and cups-driverd uses a
|
||||
case-insensitive comparison when looking for it (STR
|
||||
#1573)
|
||||
- cupsDoFileRequest() and cupsDoRequest() now work
|
||||
properly with non-blocking HTTP connections.
|
||||
- Added Swedish translation (STR #1569)
|
||||
- "make install" now installs the MIME files with world
|
||||
read permissions (STR #1565)
|
||||
- More CDSA encryption support fixes (STR #1563)
|
||||
- Updated the default mime.types file to support printing
|
||||
of files that do not have a locally-recognized MIME
|
||||
media type to raw or System V queues.
|
||||
- Updated the serial port detection code on Linux (STR
|
||||
#1562)
|
||||
- Added some more error checking to httpGetHostname()
|
||||
(STR #1561)
|
||||
- The title of some administration pages was not
|
||||
localized (STR #1548)
|
||||
- The edit-config.tmpl file was not generated or
|
||||
installed for the Spanish or Japanese localizations
|
||||
(STR #1547)
|
||||
- The mimeDelete() function freed the types before the
|
||||
filters, but the filters needed the type data (STR #1558)
|
||||
- The scheduler didn't keep track of the status pipes
|
||||
properly, leading to a bad select() for multi-file jobs
|
||||
(STR #1559)
|
||||
- The cupstestdsc program didn't validate the ordinal
|
||||
page number value for %%Page: comments.
|
||||
|
||||
|
||||
CHANGES IN CUPS V1.2rc2
|
||||
|
||||
- The scheduler was not always using the string pool,
|
||||
causing random crashes.
|
||||
- The lpmove and the web interface's Move Job button did
|
||||
not work with stopped jobs (STR #1534)
|
||||
- The PostScript filter did not handle the page-set
|
||||
option properly with number-up printing (STR #1543)
|
||||
- The scheduler now only warns about unsupported ACLs
|
||||
once (STR #1532)
|
||||
- The "fitplot" option did not work with output from
|
||||
Mozilla (STR #1542)
|
||||
- The imagetops filter did not work with Level 2 or 3
|
||||
printers (STR #1533)
|
||||
- The scheduler now recognizes PostScript files with PJL
|
||||
commands that do not include an ENTER LANGUAGE command.
|
||||
- Added --with-printcap configure option.
|
||||
- 64-bit SSL fixes for MacOS X.
|
||||
- The scheduler didn't send some printer state change
|
||||
events.
|
||||
- The scheduler didn't send jobs to busy remote printers.
|
||||
- Fixed some problems with the launchd support.
|
||||
- Added new USB printer backend for MacOS X.
|
||||
- The PostScript filter now handles files that start with
|
||||
an incomplete PJL header (PR #6076)
|
||||
- The web interface language selection code did not try
|
||||
the generic language localization (STR #1531)
|
||||
- The language cache, string pool, and transcoding caches
|
||||
are now process global instead of per-thread to avoid
|
||||
problems with GNOME and to allow for data sharing
|
||||
between threads (STR #1530)
|
||||
- Fixed a CUPS 1.1.x compatibility bug (STR #1528)
|
||||
- The web interface redirection after certain printer
|
||||
administration tasks was broken (STR #1516)
|
||||
- Web interface authorization could get stuck (STR #1512)
|
||||
- Localization updates (STR #1513, STR #1518, STR #1520)
|
||||
- The pstops filter didn't work with some files (STR
|
||||
#1523)
|
||||
- "./configure --enable-static" didn't work (STR #1522)
|
||||
- The scheduler was not using the configured default
|
||||
Group (STR #1521)
|
||||
- The web interface still did not show the localized time
|
||||
and date for some locales and systems (STR #1509)
|
||||
- httpAddrGetList() would crash on systems without
|
||||
getaddrinfo().
|
||||
- Socket URIs without a trailing slash would cause the
|
||||
port number to not be accepted (STR #1519)
|
||||
- Local raw and System V printers were not advertised as
|
||||
such for printer browsing (STR #1502)
|
||||
- The RPM spec file incorrectly put duplicate copies of
|
||||
the Japanese and Spanish web interface templates in the
|
||||
main cups package (STR #1517)
|
||||
- cupsSetDests() did not explicitly set the permissions
|
||||
of the /etc/cups/lpoptions file (STR #1508)
|
||||
- The lpq command crashed with the -h option (STR #1515)
|
||||
|
||||
|
||||
CHANGES IN CUPS V1.2rc1
|
||||
|
||||
- Documentation updates (STR #1497, STR #1498)
|
||||
@@ -42,7 +207,7 @@ CHANGES IN CUPS V1.2rc1
|
||||
#1488)
|
||||
- ppdOpen2() now converts the NickName and all UI text to
|
||||
UTF-8 (STR #1475)
|
||||
- The Set Allows Users web page did not work (STR #1486)
|
||||
- The Set Allowed Users web page did not work (STR #1486)
|
||||
- When the default policy was not set or set to a non-
|
||||
existing policy, the scheduler did not set the default
|
||||
policy name to "default" (STR #1484)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
CREDITS.txt - 2006-02-23
|
||||
CREDITS.txt - 2006-04-17
|
||||
------------------------
|
||||
|
||||
Few projects are completed by one person, and CUPS is no exception. We'd
|
||||
@@ -24,10 +24,10 @@ like to thank the following individuals for their contributions:
|
||||
Jeff Licquia - Bug fixes, beta testing, evangelism.
|
||||
Jason McMullan - Original CUPS RPM distributions.
|
||||
Wes Morgan - *BSD fixes.
|
||||
Ulrich Oldendorf - German locale.
|
||||
Daniel Nylander - Swedish localization.
|
||||
Giulio Orsero - Bug fixes and testing.
|
||||
Michal Osowiecki - Polish localization.
|
||||
Kurt Pfeifle - Bug fixes, beta testing, evangelism.
|
||||
Gilles QUERRET - French man pages.
|
||||
Petter Reinholdtsen - HP-UX compiler stuff.
|
||||
Juan Pablo González Riopedre - Spanish localization
|
||||
Stuart Stevens - HP JetDirect IPP information.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
INSTALL - CUPS v1.2rc1 - 2006-03-24
|
||||
-----------------------------------
|
||||
INSTALL - CUPS v1.2.0 - 2006-05-08
|
||||
----------------------------------
|
||||
|
||||
This file describes how to compile and install CUPS from source
|
||||
code. For more information on CUPS see the file called
|
||||
|
||||
@@ -118,11 +118,11 @@ INSTALLSTATIC = @INSTALLSTATIC@
|
||||
ARCHFLAGS = @ARCHFLAGS@
|
||||
ARFLAGS = @ARFLAGS@
|
||||
BACKLIBS = @BACKLIBS@
|
||||
CFLAGS = -I.. $(RC_CFLAGS) $(SSLFLAGS) @CPPFLAGS@ @CFLAGS@ \
|
||||
CFLAGS = -I.. $(SSLFLAGS) @CPPFLAGS@ @CFLAGS@ \
|
||||
@LARGEFILE@ @PTHREAD_FLAGS@ $(OPTIONS)
|
||||
COMMONLIBS = @LIBS@
|
||||
CUPSDLIBS = @CUPSDLIBS@
|
||||
CXXFLAGS = -I.. $(RC_CFLAGS) $(SSLFLAGS) @CPPFLAGS@ @CXXFLAGS@ \
|
||||
CXXFLAGS = -I.. $(SSLFLAGS) @CPPFLAGS@ @CXXFLAGS@ \
|
||||
@LARGEFILE@ @PTHREAD_FLAGS@ $(OPTIONS)
|
||||
CXXLIBS = @CXXLIBS@
|
||||
DSOFLAGS = @DSOFLAGS@
|
||||
@@ -130,13 +130,14 @@ DSOLIBS = @DSOLIBS@ $(COMMONLIBS)
|
||||
IMGLIBS = @IMGLIBS@ -lm
|
||||
IMGFILTERS = @IMGFILTERS@
|
||||
LDFLAGS = -L../cups -L../filter $(RC_CFLAGS) $(ARCHFLAGS) \
|
||||
@LDFLAGS@ $(OPTIM)
|
||||
@LDFLAGS@ @PIEFLAGS@ $(OPTIM)
|
||||
LINKCUPS = @LINKCUPS@ $(SSLLIBS)
|
||||
LINKCUPSIMAGE = @LINKCUPSIMAGE@
|
||||
LIBS = $(LINKCUPS) $(COMMONLIBS)
|
||||
OPTIM = @OPTIM@
|
||||
OPTIONS =
|
||||
PAMLIBS = @PAMLIBS@
|
||||
PAP = @PAP@
|
||||
PDFTOPS = @PDFTOPS@
|
||||
PHPDIR = @PHPDIR@
|
||||
SSLFLAGS = @SSLFLAGS@
|
||||
|
||||
@@ -57,6 +57,25 @@ clean:
|
||||
done
|
||||
|
||||
|
||||
#
|
||||
# Remove all non-distribution files...
|
||||
#
|
||||
|
||||
distclean: clean
|
||||
$(RM) Makedefs config.h config.log config.status
|
||||
$(RM) cups-config conf/cupsd.conf conf/pam.std
|
||||
$(RM) doc/help/standard.html doc/index.html
|
||||
$(RM) init/cups.sh init/cups-lpd
|
||||
$(RM) man/cups-deviced.man man/cups-driverd.man
|
||||
$(RM) man/cups-lpd.man man/cupsaddsmb.man man/cupsd.man
|
||||
$(RM) man/cupsd.conf.man man/lpoptions.man
|
||||
$(RM) packaging/cups templates/edit-config.tmpl templates/header.tmpl
|
||||
-$(RM) doc/*/index.html
|
||||
-$(RM) templates/*/edit-config.tmpl
|
||||
-$(RM) templates/*/header.tmpl
|
||||
-$(RM) -r autom4te*.cache
|
||||
|
||||
|
||||
#
|
||||
# Make dependencies
|
||||
#
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
README - CUPS v1.2rc1 - 2006-03-24
|
||||
----------------------------------
|
||||
README - CUPS v1.2.0 - 2006-05-08
|
||||
---------------------------------
|
||||
|
||||
Looking for compile instructions? Read the file "INSTALL.txt"
|
||||
instead...
|
||||
|
||||
@@ -19,6 +19,11 @@ scsi.o: ../cups/language.h ../cups/string.h ../config.h
|
||||
serial.o: ../cups/backend.h ../cups/cups.h ../cups/ipp.h ../cups/http.h
|
||||
serial.o: ../cups/md5.h ../cups/ppd.h ../cups/array.h ../cups/file.h
|
||||
serial.o: ../cups/language.h ../cups/string.h ../config.h
|
||||
snmp.o: ../cups/backend.h ../cups/http-private.h ../config.h ../cups/http.h
|
||||
snmp.o: ../cups/md5.h ../cups/ipp-private.h ../cups/ipp.h ../cups/cups.h
|
||||
snmp.o: ../cups/ppd.h ../cups/array.h ../cups/file.h ../cups/language.h
|
||||
snmp.o: ../cups/string.h ../cups/array.h ../cups/file.h ieee1284.c
|
||||
snmp.o: ../cups/debug.h
|
||||
socket.o: ../cups/backend.h ../cups/http-private.h ../config.h ../cups/http.h
|
||||
socket.o: ../cups/md5.h ../cups/ipp-private.h ../cups/ipp.h ../cups/cups.h
|
||||
socket.o: ../cups/ppd.h ../cups/array.h ../cups/file.h ../cups/language.h
|
||||
|
||||
@@ -27,10 +27,10 @@
|
||||
include ../Makedefs
|
||||
|
||||
RBACKENDS = ipp lpd
|
||||
UBACKENDS = parallel scsi serial socket usb
|
||||
UBACKENDS = $(PAP) parallel scsi serial snmp socket usb
|
||||
TARGETS = betest test1284 $(RBACKENDS) $(UBACKENDS)
|
||||
OBJS = betest.o ipp.o lpd.o parallel.o scsi.o \
|
||||
serial.o socket.o test1284.o usb.o
|
||||
OBJS = betest.o ipp.o lpd.o pap.o parallel.o scsi.o \
|
||||
serial.o snmp.o socket.o test1284.o usb.o
|
||||
|
||||
|
||||
#
|
||||
@@ -136,6 +136,15 @@ lpd: lpd.o ../cups/$(LIBCUPS)
|
||||
$(CC) $(LDFLAGS) -o lpd lpd.o $(LIBS)
|
||||
|
||||
|
||||
#
|
||||
# pap
|
||||
#
|
||||
|
||||
pap: pap.o ../cups/$(LIBCUPS)
|
||||
echo Linking $@...
|
||||
$(CC) $(LDFLAGS) -o pap pap.o $(BACKLIBS) $(LIBS) -framework AppleTalk
|
||||
|
||||
|
||||
#
|
||||
# parallel
|
||||
#
|
||||
@@ -165,6 +174,15 @@ serial: serial.o ../cups/$(LIBCUPS)
|
||||
$(CC) $(LDFLAGS) -o serial serial.o $(BACKLIBS) $(LIBS)
|
||||
|
||||
|
||||
#
|
||||
# snmp
|
||||
#
|
||||
|
||||
snmp: snmp.o ../cups/$(LIBCUPS)
|
||||
echo Linking $@...
|
||||
$(CC) $(LDFLAGS) -o snmp snmp.o $(LIBS)
|
||||
|
||||
|
||||
#
|
||||
# socket
|
||||
#
|
||||
|
||||
@@ -25,8 +25,9 @@
|
||||
*
|
||||
* Contents:
|
||||
*
|
||||
* get_device_id() - Get the IEEE-1284 device ID string and corresponding
|
||||
* URI.
|
||||
* get_device_id() - Get the IEEE-1284 device ID string and corresponding
|
||||
* URI.
|
||||
* get_make_model() - Get the make and model string from the device ID.
|
||||
*/
|
||||
|
||||
/*
|
||||
@@ -34,21 +35,14 @@
|
||||
*/
|
||||
|
||||
#include <cups/debug.h>
|
||||
#ifdef __linux
|
||||
# include <sys/ioctl.h>
|
||||
# include <linux/lp.h>
|
||||
# define IOCNR_GET_DEVICE_ID 1
|
||||
# define LPIOC_GET_DEVICE_ID(len) _IOC(_IOC_READ, 'P', IOCNR_GET_DEVICE_ID, len)
|
||||
#endif /* __linux */
|
||||
|
||||
#ifdef __sun
|
||||
# ifdef __sparc
|
||||
# include <sys/ecppio.h>
|
||||
# else
|
||||
# include <sys/ioccom.h>
|
||||
# include <sys/ecppsys.h>
|
||||
# endif /* __sparc */
|
||||
#endif /* __sun */
|
||||
|
||||
/*
|
||||
* Prototypes...
|
||||
*/
|
||||
|
||||
static int get_make_model(const char *device_id, char *make_model,
|
||||
int make_model_size);
|
||||
|
||||
|
||||
/*
|
||||
@@ -56,6 +50,24 @@
|
||||
* corresponding URI.
|
||||
*/
|
||||
|
||||
#ifndef SNMP_BACKEND
|
||||
# ifdef __linux
|
||||
# include <sys/ioctl.h>
|
||||
# include <linux/lp.h>
|
||||
# define IOCNR_GET_DEVICE_ID 1
|
||||
# define LPIOC_GET_DEVICE_ID(len) _IOC(_IOC_READ, 'P', IOCNR_GET_DEVICE_ID, len)
|
||||
# endif /* __linux */
|
||||
|
||||
# ifdef __sun
|
||||
# ifdef __sparc
|
||||
# include <sys/ecppio.h>
|
||||
# else
|
||||
# include <sys/ioccom.h>
|
||||
# include <sys/ecppsys.h>
|
||||
# endif /* __sparc */
|
||||
# endif /* __sun */
|
||||
|
||||
|
||||
int /* O - 0 on success, -1 on failure */
|
||||
get_device_id(
|
||||
int fd, /* I - File descriptor */
|
||||
@@ -70,9 +82,9 @@ get_device_id(
|
||||
char *attr, /* 1284 attribute */
|
||||
*delim, /* 1284 delimiter */
|
||||
*uriptr, /* Pointer into URI */
|
||||
*mfg, /* Manufacturer string */
|
||||
*mdl, /* Model string */
|
||||
manufacturer[256], /* Manufacturer string */
|
||||
serial_number[1024]; /* Serial number string */
|
||||
int manulen; /* Length of manufacturer string */
|
||||
#ifdef __linux
|
||||
int length; /* Length of device ID info */
|
||||
#endif /* __linux */
|
||||
@@ -80,6 +92,7 @@ get_device_id(
|
||||
struct ecpp_device_id did; /* Device ID buffer */
|
||||
#endif /* __sun && ECPPIOC_GETDEVID */
|
||||
|
||||
|
||||
DEBUG_printf(("get_device_id(fd=%d, device_id=%p, device_id_size=%d, "
|
||||
"make_model=%p, make_model_size=%d, scheme=\"%s\", "
|
||||
"uri=%p, uri_size=%d)\n", fd, device_id, device_id_size,
|
||||
@@ -174,6 +187,157 @@ get_device_id(
|
||||
if (!*device_id)
|
||||
return (-1);
|
||||
|
||||
/*
|
||||
* Get the make and model...
|
||||
*/
|
||||
|
||||
get_make_model(device_id, make_model, make_model_size);
|
||||
|
||||
/*
|
||||
* Then generate a device URI...
|
||||
*/
|
||||
|
||||
if (scheme && uri && uri_size > 32)
|
||||
{
|
||||
/*
|
||||
* Look for the serial number field...
|
||||
*/
|
||||
|
||||
if ((attr = strstr(device_id, "SERN:")) != NULL)
|
||||
attr += 5;
|
||||
else if ((attr = strstr(device_id, "SERIALNUMBER:")) != NULL)
|
||||
attr += 13;
|
||||
else if ((attr = strstr(device_id, ";SN:")) != NULL)
|
||||
attr += 4;
|
||||
|
||||
if (attr)
|
||||
{
|
||||
strlcpy(serial_number, attr, sizeof(serial_number));
|
||||
|
||||
if ((delim = strchr(serial_number, ';')) != NULL)
|
||||
*delim = '\0';
|
||||
}
|
||||
else
|
||||
serial_number[0] = '\0';
|
||||
|
||||
/*
|
||||
* Generate the device URI from the manufacturer, make_model, and
|
||||
* serial number strings.
|
||||
*/
|
||||
|
||||
snprintf(uri, uri_size, "%s://", scheme);
|
||||
|
||||
if ((attr = strstr(device_id, "MANUFACTURER:")) != NULL)
|
||||
attr += 13;
|
||||
else if ((attr = strstr(device_id, "Manufacturer:")) != NULL)
|
||||
attr += 13;
|
||||
else if ((attr = strstr(device_id, "MFG:")) != NULL)
|
||||
attr += 4;
|
||||
|
||||
if (attr)
|
||||
{
|
||||
strlcpy(manufacturer, attr, sizeof(manufacturer));
|
||||
|
||||
if ((delim = strchr(manufacturer, ';')) != NULL)
|
||||
*delim = '\0';
|
||||
|
||||
if (!strcasecmp(manufacturer, "Hewlett-Packard"))
|
||||
strcpy(manufacturer, "HP");
|
||||
}
|
||||
else
|
||||
{
|
||||
strlcpy(manufacturer, make_model, sizeof(manufacturer));
|
||||
|
||||
if ((delim = strchr(manufacturer, ' ')) != NULL)
|
||||
*delim = '\0';
|
||||
}
|
||||
|
||||
manulen = strlen(manufacturer);
|
||||
|
||||
for (uriptr = uri + strlen(uri), delim = manufacturer;
|
||||
*delim && uriptr < (uri + uri_size - 3);
|
||||
delim ++)
|
||||
if (*delim == ' ')
|
||||
{
|
||||
*uriptr++ = '%';
|
||||
*uriptr++ = '2';
|
||||
*uriptr++ = '0';
|
||||
}
|
||||
else
|
||||
*uriptr++ = *delim;
|
||||
|
||||
*uriptr++ = '/';
|
||||
|
||||
if (!strncasecmp(make_model, manufacturer, manulen))
|
||||
{
|
||||
delim = make_model + manulen;
|
||||
|
||||
while (isspace(*delim & 255))
|
||||
delim ++;
|
||||
}
|
||||
else
|
||||
delim = make_model;
|
||||
|
||||
for (; *delim && uriptr < (uri + uri_size - 3); delim ++)
|
||||
if (*delim == ' ')
|
||||
{
|
||||
*uriptr++ = '%';
|
||||
*uriptr++ = '2';
|
||||
*uriptr++ = '0';
|
||||
}
|
||||
else
|
||||
*uriptr++ = *delim;
|
||||
|
||||
if (serial_number[0])
|
||||
{
|
||||
/*
|
||||
* Add the serial number to the URI...
|
||||
*/
|
||||
|
||||
strlcpy(uriptr, "?serial=", uri_size - (uriptr - uri));
|
||||
strlcat(uriptr, serial_number, uri_size - (uriptr - uri));
|
||||
}
|
||||
else
|
||||
*uriptr = '\0';
|
||||
}
|
||||
|
||||
return (0);
|
||||
}
|
||||
#endif /* !SNMP_BACKEND */
|
||||
|
||||
|
||||
/*
|
||||
* 'get_make_model()' - Get the make and model string from the device ID.
|
||||
*/
|
||||
|
||||
int /* O - 0 on success, -1 on failure */
|
||||
get_make_model(
|
||||
const char *device_id, /* O - 1284 device ID */
|
||||
char *make_model, /* O - Make/model */
|
||||
int make_model_size) /* I - Size of buffer */
|
||||
{
|
||||
char *attr, /* 1284 attribute */
|
||||
*delim, /* 1284 delimiter */
|
||||
*mfg, /* Manufacturer string */
|
||||
*mdl; /* Model string */
|
||||
|
||||
|
||||
DEBUG_printf(("get_make_model(device_id=\"%s\", "
|
||||
"make_model=%p, make_model_size=%d)\n", device_id,
|
||||
make_model, make_model_size));
|
||||
|
||||
/*
|
||||
* Range check input...
|
||||
*/
|
||||
|
||||
if (!device_id || !*device_id || !make_model || make_model_size < 32)
|
||||
{
|
||||
DEBUG_puts("get_make_model: Bad args!");
|
||||
return (-1);
|
||||
}
|
||||
|
||||
*make_model = '\0';
|
||||
|
||||
/*
|
||||
* Look for the description field...
|
||||
*/
|
||||
@@ -224,15 +388,62 @@ get_device_id(
|
||||
|
||||
if ((mfg = strstr(device_id, "MANUFACTURER:")) != NULL)
|
||||
mfg += 13;
|
||||
else if ((mfg = strstr(device_id, "Manufacturer:")) != NULL)
|
||||
mfg += 13;
|
||||
else if ((mfg = strstr(device_id, "MFG:")) != NULL)
|
||||
mfg += 4;
|
||||
|
||||
if ((mdl = strstr(device_id, "MODEL:")) != NULL)
|
||||
mdl += 6;
|
||||
else if ((mdl = strstr(device_id, "Model:")) != NULL)
|
||||
mdl += 6;
|
||||
else if ((mdl = strstr(device_id, "MDL:")) != NULL)
|
||||
mdl += 4;
|
||||
|
||||
if (attr)
|
||||
if (mdl)
|
||||
{
|
||||
/*
|
||||
* Build a make-model string from the manufacturer and model attributes...
|
||||
*/
|
||||
|
||||
if (mfg)
|
||||
{
|
||||
if (!strncasecmp(mfg, "Hewlett-Packard", 15))
|
||||
strlcpy(make_model, "HP", make_model_size);
|
||||
else
|
||||
strlcpy(make_model, mfg, make_model_size);
|
||||
|
||||
if ((delim = strchr(make_model, ';')) != NULL)
|
||||
*delim = '\0';
|
||||
|
||||
if (!strncasecmp(make_model, mdl, strlen(make_model)))
|
||||
{
|
||||
/*
|
||||
* Just copy model string, since it has the manufacturer...
|
||||
*/
|
||||
|
||||
strlcpy(make_model, mdl, make_model_size);
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Concatenate the make and model...
|
||||
*/
|
||||
|
||||
strlcat(make_model, " ", make_model_size);
|
||||
strlcat(make_model, mdl, make_model_size);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Just copy model string, since it has the manufacturer...
|
||||
*/
|
||||
|
||||
strlcpy(make_model, mdl, make_model_size);
|
||||
}
|
||||
}
|
||||
else if (attr)
|
||||
{
|
||||
/*
|
||||
* Use description...
|
||||
@@ -257,38 +468,6 @@ get_device_id(
|
||||
strlcpy(make_model, attr, make_model_size);
|
||||
}
|
||||
}
|
||||
else if (mfg && mdl)
|
||||
{
|
||||
/*
|
||||
* Build a make-model string from the manufacturer and model attributes...
|
||||
*/
|
||||
|
||||
if (!strncasecmp(mfg, "Hewlett-Packard", 15))
|
||||
strlcpy(make_model, "HP", make_model_size);
|
||||
else
|
||||
strlcpy(make_model, mfg, make_model_size);
|
||||
|
||||
if ((delim = strchr(make_model, ';')) != NULL)
|
||||
*delim = '\0';
|
||||
|
||||
if (!strncasecmp(make_model, mdl, strlen(make_model)))
|
||||
{
|
||||
/*
|
||||
* Just copy model string, since it has the manufacturer...
|
||||
*/
|
||||
|
||||
strlcpy(make_model, mdl, make_model_size);
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Concatenate the make and model...
|
||||
*/
|
||||
|
||||
strlcat(make_model, " ", make_model_size);
|
||||
strlcat(make_model, mdl, make_model_size);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
@@ -298,73 +477,31 @@ get_device_id(
|
||||
strlcpy(make_model, "Unknown", make_model_size);
|
||||
}
|
||||
|
||||
/*
|
||||
* Strip trailing data...
|
||||
*/
|
||||
|
||||
if ((delim = strchr(make_model, ';')) != NULL)
|
||||
*delim = '\0';
|
||||
|
||||
if (scheme && uri && uri_size > 32)
|
||||
{
|
||||
/*
|
||||
* Look for the serial number field...
|
||||
*/
|
||||
/*
|
||||
* Strip trailing whitespace...
|
||||
*/
|
||||
|
||||
if ((attr = strstr(device_id, "SERN:")) != NULL)
|
||||
attr += 5;
|
||||
else if ((attr = strstr(device_id, "SERIALNUMBER:")) != NULL)
|
||||
attr += 13;
|
||||
else if ((attr = strstr(device_id, ";SN:")) != NULL)
|
||||
attr += 4;
|
||||
|
||||
if (attr)
|
||||
{
|
||||
strlcpy(serial_number, attr, sizeof(serial_number));
|
||||
|
||||
if ((delim = strchr(serial_number, ';')) != NULL)
|
||||
*delim = '\0';
|
||||
}
|
||||
for (delim = make_model + strlen(make_model) - 1; delim >= make_model; delim --)
|
||||
if (isspace(*delim & 255))
|
||||
*delim = '\0';
|
||||
else
|
||||
serial_number[0] = '\0';
|
||||
break;
|
||||
|
||||
/*
|
||||
* Generate the device URI from the make_model and serial number strings.
|
||||
*/
|
||||
/*
|
||||
* Return...
|
||||
*/
|
||||
|
||||
snprintf(uri, uri_size, "%s://", scheme);
|
||||
for (uriptr = uri + strlen(uri), delim = make_model;
|
||||
*delim && uriptr < (uri + uri_size - 1);
|
||||
delim ++)
|
||||
if (*delim == ' ')
|
||||
{
|
||||
delim ++;
|
||||
*uriptr++ = '/';
|
||||
break;
|
||||
}
|
||||
else
|
||||
*uriptr++ = *delim;
|
||||
|
||||
for (; *delim && uriptr < (uri + uri_size - 3); delim ++)
|
||||
if (*delim == ' ')
|
||||
{
|
||||
*uriptr++ = '%';
|
||||
*uriptr++ = '2';
|
||||
*uriptr++ = '0';
|
||||
}
|
||||
else
|
||||
*uriptr++ = *delim;
|
||||
|
||||
*uriptr = '\0';
|
||||
|
||||
if (serial_number[0])
|
||||
{
|
||||
/*
|
||||
* Add the serial number to the URI...
|
||||
*/
|
||||
|
||||
strlcat(uri, "?serial=", uri_size);
|
||||
strlcat(uri, serial_number, uri_size);
|
||||
}
|
||||
}
|
||||
|
||||
return (0);
|
||||
if (make_model[0])
|
||||
return (0);
|
||||
else
|
||||
return (-1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1215,7 +1215,7 @@ compress_files(int num_files, /* I - Number of files */
|
||||
*out; /* Output file */
|
||||
struct stat outinfo; /* Output file information */
|
||||
char filename[1024], /* Temporary filename */
|
||||
buffer[65536]; /* Copy buffer */
|
||||
buffer[32768]; /* Copy buffer */
|
||||
|
||||
|
||||
fprintf(stderr, "DEBUG: Compressing %d job files...\n", num_files);
|
||||
|
||||
@@ -590,7 +590,7 @@ lpd_queue(const char *hostname, /* I - Host to connect to */
|
||||
#endif /* __APPLE__ */
|
||||
size_t nbytes; /* Number of bytes written */
|
||||
off_t tbytes; /* Total bytes written */
|
||||
char buffer[65536]; /* Output buffer */
|
||||
char buffer[32768]; /* Output buffer */
|
||||
#if defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET)
|
||||
struct sigaction action; /* Actions for POSIX signals */
|
||||
#endif /* HAVE_SIGACTION && !HAVE_SIGSET */
|
||||
|
||||
@@ -466,8 +466,6 @@ list_devices(void)
|
||||
strcpy(basedevice, "/dev/parallel/");
|
||||
else if (!access("/dev/printers/", 0))
|
||||
strcpy(basedevice, "/dev/printers/");
|
||||
else if (!access("/dev/par0", 0))
|
||||
strcpy(basedevice, "/dev/par");
|
||||
else
|
||||
strcpy(basedevice, "/dev/lp");
|
||||
|
||||
|
||||
@@ -87,6 +87,11 @@
|
||||
# include <IOKit/IOBSD.h>
|
||||
#endif /* __APPLE__ */
|
||||
|
||||
#if defined(__linux) && defined(TIOCGSERIAL)
|
||||
# include <linux/serial.h>
|
||||
# include <linux/ioctl.h>
|
||||
#endif /* __linux && TIOCGSERIAL */
|
||||
|
||||
|
||||
/*
|
||||
* Local functions...
|
||||
@@ -663,21 +668,48 @@ list_devices(void)
|
||||
{
|
||||
#if defined(__hpux) || defined(__sgi) || defined(__sun) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__DragonFly__)
|
||||
static char *funky_hex = "0123456789abcdefghijklmnopqrstuvwxyz";
|
||||
/* Funky hex numbering used for some devices */
|
||||
/* Funky hex numbering used for some *
|
||||
* devices */
|
||||
#endif /* __hpux || __sgi || __sun || __FreeBSD__ || __OpenBSD__ */
|
||||
|
||||
#if defined(__linux) || defined(linux) || defined(__linux__)
|
||||
int i, j; /* Looping vars */
|
||||
int fd; /* File descriptor */
|
||||
char device[255]; /* Device filename */
|
||||
#ifdef __linux
|
||||
int i, j; /* Looping vars */
|
||||
int fd; /* File descriptor */
|
||||
char device[255]; /* Device filename */
|
||||
# ifdef TIOCGSERIAL
|
||||
struct serial_struct serinfo; /* serial port info */
|
||||
# endif /* TIOCGSERIAL */
|
||||
|
||||
|
||||
for (i = 0; i < 100; i ++)
|
||||
{
|
||||
sprintf(device, "/dev/ttyS%d", i);
|
||||
|
||||
if ((fd = open(device, O_WRONLY | O_NOCTTY | O_NDELAY)) >= 0)
|
||||
{
|
||||
# ifdef TIOCGSERIAL
|
||||
/*
|
||||
* See if this port exists...
|
||||
*/
|
||||
|
||||
serinfo.reserved_char[0] = 0;
|
||||
|
||||
if (!ioctl(fd, TIOCGSERIAL, &serinfo))
|
||||
{
|
||||
if (serinfo.type == PORT_UNKNOWN)
|
||||
{
|
||||
/*
|
||||
* Nope...
|
||||
*/
|
||||
|
||||
close(fd);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
# endif /* TIOCGSERIAL */
|
||||
|
||||
close(fd);
|
||||
|
||||
# if defined(_ARCH_PPC) || defined(powerpc) || defined(__powerpc)
|
||||
printf("serial serial:%s?baud=230400 \"Unknown\" \"Serial Port #%d\"\n",
|
||||
device, i + 1);
|
||||
@@ -824,13 +856,13 @@ list_devices(void)
|
||||
{
|
||||
sprintf(device, "/dev/cua/%c", 'a' + i);
|
||||
if (access(device, 0) == 0)
|
||||
#ifdef B115200
|
||||
# ifdef B115200
|
||||
printf("serial serial:%s?baud=115200 \"Unknown\" \"Serial Port #%d\"\n",
|
||||
device, i + 1);
|
||||
#else
|
||||
# else
|
||||
printf("serial serial:%s?baud=38400 \"Unknown\" \"Serial Port #%d\"\n",
|
||||
device, i + 1);
|
||||
#endif /* B115200 */
|
||||
# endif /* B115200 */
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1063,7 +1095,6 @@ list_devices(void)
|
||||
CFMutableDictionaryRef classesToMatch;
|
||||
io_object_t serialService;
|
||||
|
||||
printf("serial serial \"Unknown\" \"Serial Printer (serial)\"\n");
|
||||
|
||||
kernResult = IOMasterPort(MACH_PORT_NULL, &masterPort);
|
||||
if (KERN_SUCCESS != kernResult)
|
||||
@@ -1117,8 +1148,8 @@ list_devices(void)
|
||||
CFRelease(bsdPathAsCFString);
|
||||
|
||||
if (result)
|
||||
printf("serial serial:%s?baud=115200 \"Unknown\" \"%s\"\n", bsdPath,
|
||||
serialName);
|
||||
printf("serial serial:%s?baud=115200 \"Unknown\" \"%s\"\n",
|
||||
bsdPath, serialName);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1126,7 +1157,11 @@ list_devices(void)
|
||||
IOObjectRelease(serialService);
|
||||
}
|
||||
|
||||
IOObjectRelease(serialPortIterator); /* Release the iterator. */
|
||||
/*
|
||||
* Release the iterator.
|
||||
*/
|
||||
|
||||
IOObjectRelease(serialPortIterator);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,172 @@
|
||||
snmp.txt - 2006-04-19
|
||||
---------------------
|
||||
|
||||
This file lists the "interesting" bits from the command:
|
||||
|
||||
snmpwalk -v 1 -c public HOST .1
|
||||
|
||||
for many network print servers and internal cards. It is mainly here
|
||||
for SNMP documentation and development purposes.
|
||||
|
||||
|
||||
AXIS 5600
|
||||
|
||||
SNMPv2-MIB::sysDescr.0 = STRING: HP ETHERNET MULTI-ENVIRONMENT,ROM J.sp.00,JETDIRECT EX,JD28,EEPROM 6.16.5
|
||||
SNMPv2-MIB::sysName.0 = STRING:
|
||||
HOST-RESOURCES-MIB::hrDeviceType.1 = OID: HOST-RESOURCES-TYPES::hrDevicePrinter
|
||||
HOST-RESOURCES-MIB::hrDeviceType.2 = OID: HOST-RESOURCES-TYPES::hrDevicePrinter
|
||||
HOST-RESOURCES-MIB::hrDeviceType.3 = OID: HOST-RESOURCES-TYPES::hrDevicePrinter
|
||||
HOST-RESOURCES-MIB::hrDeviceDescr.1 = STRING: Hewlett-Packard hp LaserJet 3380
|
||||
HOST-RESOURCES-MIB::hrDeviceDescr.2 = STRING: Axis AXIS 5600
|
||||
HOST-RESOURCES-MIB::hrDeviceDescr.3 = STRING: Axis AXIS 5600
|
||||
HOST-RESOURCES-MIB::hrDeviceID.1 = OID: SNMPv2-SMI::zeroDotZero
|
||||
HOST-RESOURCES-MIB::hrDeviceID.2 = OID: SNMPv2-SMI::zeroDotZero
|
||||
HOST-RESOURCES-MIB::hrDeviceID.3 = OID: SNMPv2-SMI::zeroDotZero
|
||||
SNMPv2-SMI::enterprises.11.2.4.3.10.8.0 = STRING: "AXIS433AE8"
|
||||
SNMPv2-SMI::enterprises.368.2.3.2.601.0 = INTEGER: 9100
|
||||
SNMPv2-SMI::enterprises.368.2.3.2.602.0 = INTEGER: 9101
|
||||
SNMPv2-SMI::enterprises.368.2.3.2.603.0 = INTEGER: 9102
|
||||
SNMPv2-SMI::enterprises.368.2.3.10.901.0 = STRING: "AXIS433AE8"
|
||||
|
||||
|
||||
AXIS OfficeBasic
|
||||
|
||||
SNMPv2-MIB::sysDescr.0 = STRING: AXIS OfficeBasic Parallel Network Print Server V6.43 Sep 4 2003
|
||||
HOST-RESOURCES-MIB::hrDeviceType.1 = OID: HOST-RESOURCES-TYPES::hrDevicePrinter
|
||||
HOST-RESOURCES-MIB::hrDeviceDescr.1 = STRING: EPSON Stylus Photo 870
|
||||
HOST-RESOURCES-MIB::hrDeviceID.1 = OID: SNMPv2-SMI::zeroDotZero
|
||||
|
||||
|
||||
DLink DP-301P+
|
||||
|
||||
SNMPv2-MIB::sysDescr.0 = STRING: D-Link DP-301P+ Print Server
|
||||
|
||||
|
||||
Genicom ML280
|
||||
|
||||
SNMPv2-MIB::sysDescr.0 = STRING: GENICOM microLaser 280
|
||||
SNMPv2-MIB::sysName.0 = STRING: PRQ_004F75
|
||||
HOST-RESOURCES-MIB::hrDeviceType.1 = OID: HOST-RESOURCES-TYPES::hrDevicePrinter
|
||||
HOST-RESOURCES-MIB::hrDeviceDescr.1 = STRING: MANUFACTURER:GENICOM;MODEL:microLaser 280;
|
||||
HOST-RESOURCES-MIB::hrDeviceID.1 = OID: SNMPv2-SMI::enterprises.3369.1.1.2.4
|
||||
|
||||
|
||||
EPSON Type-B Network Card
|
||||
|
||||
SNMPv2-MIB::sysDescr.0 = STRING: EPSON Type-B 10Base-T/100Base-TX Print Server
|
||||
SNMPv2-MIB::sysName.0 = STRING: StylusPro7600-BB87A8
|
||||
HOST-RESOURCES-MIB::hrDeviceType.1 = OID: HOST-RESOURCES-TYPES::hrDevicePrinter
|
||||
HOST-RESOURCES-MIB::hrDeviceDescr.1 = STRING: EPSON Stylus Pro 7600
|
||||
HOST-RESOURCES-MIB::hrDeviceID.1 = OID: SNMPv2-SMI::enterprises.1248.1.2.1.22.69.109.117.108.97.116.101.83.116.121.108.117.115.32.80.114.111.32.55.54.48.48
|
||||
SNMPv2-SMI::enterprises.11.2.3.9.1.1.7.0 = STRING: "MFG:EPSON;CMD:ESCPL2,BDC;MDL:Stylus Pro 7600;CLS:PRINTER;DES:EPSON Stylus Pro 7600;"
|
||||
SNMPv2-SMI::enterprises.1248.1.2.2.1.1.1.1.1 = STRING: "MFG:EPSON;CMD:ESCPL2,BDC;MDL:Stylus Pro 7600;CLS:PRINTER;DES:EPSON Stylus Pro 7600;"
|
||||
|
||||
|
||||
EPSON Wireless 802.11b Print Server
|
||||
|
||||
SNMPv2-MIB::sysDescr.0 = STRING: EPSON Wireless LAN Print Interface compatible with an HP JETDIRECT EX
|
||||
SNMPv2-MIB::sysName.0 = STRING: EAI_0F550B
|
||||
HOST-RESOURCES-MIB::hrDeviceType.1 = OID: HOST-RESOURCES-TYPES::hrDevicePrinter
|
||||
HOST-RESOURCES-MIB::hrDeviceDescr.1 = STRING:
|
||||
HOST-RESOURCES-MIB::hrDeviceID.1 = OID: SNMPv2-SMI::zeroDotZero
|
||||
|
||||
|
||||
HP JetDirect EX3plus
|
||||
|
||||
SNMPv2-MIB::sysDescr.0 = STRING: HP ETHERNET MULTI-ENVIRONMENT,ROM D.04.03,JETDIRECT EX,JD26,EEPROM D.05.22
|
||||
SNMPv2-MIB::sysName.0 = STRING: NPID1EC0F
|
||||
|
||||
|
||||
HP LJ4000
|
||||
|
||||
SNMPv2-MIB::sysDescr.0 = STRING: HP ETHERNET MULTI-ENVIRONMENT,ROM G.05.34,JETDIRECT,JD30,EEPROM G.08.32
|
||||
SNMPv2-MIB::sysName.0 = STRING:
|
||||
HOST-RESOURCES-MIB::hrDeviceType.1 = OID: HOST-RESOURCES-TYPES::hrDevicePrinter
|
||||
HOST-RESOURCES-MIB::hrDeviceDescr.1 = STRING: HP LaserJet 4000 Series
|
||||
HOST-RESOURCES-MIB::hrDeviceID.1 = OID: SNMPv2-SMI::enterprises.11.2.3.9.1.2.5
|
||||
|
||||
|
||||
HP CLJ4550
|
||||
|
||||
SNMPv2-MIB::sysDescr.0 = STRING: HP ETHERNET MULTI-ENVIRONMENT,ROM L.20.07,JETDIRECT,JD84,EEPROM L.21.22,CIDATE 07/06/2001
|
||||
SNMPv2-MIB::sysName.0 = STRING: NPI02FDE7
|
||||
HOST-RESOURCES-MIB::hrDeviceDescr.1 = STRING: HP Color LaserJet 4550
|
||||
HOST-RESOURCES-MIB::hrDeviceDescr.2 = STRING: Hewlett-Packard Dynamic RAM Disk
|
||||
HOST-RESOURCES-MIB::hrDeviceID.1 = OID: SNMPv2-SMI::enterprises.11.2.3.9.1.2.14
|
||||
|
||||
|
||||
Lexmark C522
|
||||
|
||||
SNMPv2-MIB::sysDescr.0 = STRING: Lexmark C522 version NS.NP.N212 kernel 2.6.6 All-N-1
|
||||
SNMPv2-MIB::sysName.0 = STRING: ET0004000D0CCA
|
||||
HOST-RESOURCES-MIB::hrDeviceType.1 = OID: HOST-RESOURCES-TYPES::hrDevicePrinter
|
||||
HOST-RESOURCES-MIB::hrDeviceType.2 = OID: HOST-RESOURCES-TYPES::hrDeviceNonVolatileMemory
|
||||
HOST-RESOURCES-MIB::hrDeviceType.3 = OID: HOST-RESOURCES-TYPES::hrDeviceProcessor
|
||||
HOST-RESOURCES-MIB::hrDeviceType.4 = OID: HOST-RESOURCES-TYPES::hrDeviceSerialPort
|
||||
HOST-RESOURCES-MIB::hrDeviceType.5 = OID: HOST-RESOURCES-TYPES::hrDeviceNetwork
|
||||
HOST-RESOURCES-MIB::hrDeviceDescr.1 = STRING: Lexmark C522 9421TTV LS.FA.P129
|
||||
HOST-RESOURCES-MIB::hrDeviceDescr.2 = STRING: Nonvolatile RAM
|
||||
HOST-RESOURCES-MIB::hrDeviceDescr.3 = STRING: IBM 750 Rev CXr
|
||||
HOST-RESOURCES-MIB::hrDeviceDescr.4 = STRING: USB Interface
|
||||
HOST-RESOURCES-MIB::hrDeviceDescr.5 = STRING: Network Interface
|
||||
HOST-RESOURCES-MIB::hrDeviceID.1 = OID: SNMPv2-SMI::zeroDotZero
|
||||
HOST-RESOURCES-MIB::hrDeviceID.2 = OID: SNMPv2-SMI::zeroDotZero
|
||||
HOST-RESOURCES-MIB::hrDeviceID.3 = OID: SNMPv2-SMI::zeroDotZero
|
||||
HOST-RESOURCES-MIB::hrDeviceID.4 = OID: SNMPv2-SMI::zeroDotZero
|
||||
HOST-RESOURCES-MIB::hrDeviceID.5 = OID: SNMPv2-SMI::enterprises.641.1
|
||||
SNMPv2-SMI::enterprises.641.2.1.2.1.2.1 = STRING: "Lexmark C522"
|
||||
SNMPv2-SMI::enterprises.641.2.1.2.1.3.1 = STRING: "MANUFACTURER:Lexmark International;COMMAND SET:;MODEL:Lexmark C522"
|
||||
|
||||
|
||||
Linksys EPSX3
|
||||
|
||||
SNMPv2-MIB::sysDescr.0 = STRING: ETHERNET MULTI-ENVIRONMENT.ROM, JETDIRECT EX, EEPROM 6016
|
||||
|
||||
|
||||
NetGear PS113
|
||||
|
||||
SNMPv2-MIB::sysDescr.0 = STRING: A SNMP proxy agent.
|
||||
|
||||
|
||||
Okidata C7200
|
||||
|
||||
SNMPv2-MIB::sysDescr.0 = STRING: OkiLAN 6200e
|
||||
SNMPv2-MIB::sysName.0 = STRING: OKI7009715
|
||||
HOST-RESOURCES-MIB::hrDeviceType.1 = OID: HOST-RESOURCES-TYPES::hrDevicePrinter
|
||||
HOST-RESOURCES-MIB::hrDeviceType.2 = OID: HOST-RESOURCES-TYPES::hrDeviceNonVolat
|
||||
ileMemory
|
||||
HOST-RESOURCES-MIB::hrDeviceDescr.1 = STRING: C7200
|
||||
HOST-RESOURCES-MIB::hrDeviceDescr.2 = STRING: FLASH0
|
||||
HOST-RESOURCES-MIB::hrDeviceID.1 = OID: SNMPv2-SMI::enterprises.2001.1.1.1.1
|
||||
HOST-RESOURCES-MIB::hrDeviceID.2 = OID: SNMPv2-SMI::zeroDotZero
|
||||
SNMPv2-SMI::mib-2.43.14.1.1.3.1.1 = STRING: "IEEE 1284"
|
||||
SNMPv2-SMI::mib-2.43.14.1.1.3.1.2 = STRING: "EtherTalk Phase 2"
|
||||
SNMPv2-SMI::mib-2.43.14.1.1.3.1.3 = STRING: "LPD"
|
||||
SNMPv2-SMI::mib-2.43.14.1.1.3.1.4 = STRING: "Netware Rprinter"
|
||||
SNMPv2-SMI::mib-2.43.14.1.1.3.1.5 = STRING: "Netware Bindery or NDS Pserver"
|
||||
SNMPv2-SMI::mib-2.43.14.1.1.3.1.6 = STRING: "Raw TCP Port 9100"
|
||||
SNMPv2-SMI::mib-2.43.14.1.1.3.1.7 = STRING: "FTP"
|
||||
SNMPv2-SMI::mib-2.43.14.1.1.3.1.8 = STRING: "DLC/LLC"
|
||||
SNMPv2-SMI::enterprises.2001.1.1.1.1.1.3530.0 = STRING: "C7200"
|
||||
|
||||
|
||||
Xerox N2025
|
||||
|
||||
SNMPv2-MIB::sysDescr.0 = STRING: Xerox DocuPrint N2025 Network Laser Printer - 2.12-02
|
||||
SNMPv2-MIB::sysName.0 = STRING:
|
||||
HOST-RESOURCES-MIB::hrDeviceType.1 = OID: HOST-RESOURCES-TYPES::hrDevicePrinter
|
||||
HOST-RESOURCES-MIB::hrDeviceType.2 = OID: HOST-RESOURCES-TYPES::hrDeviceParallelPort
|
||||
HOST-RESOURCES-MIB::hrDeviceType.3 = OID: HOST-RESOURCES-TYPES::hrDeviceNetwork
|
||||
HOST-RESOURCES-MIB::hrDeviceType.6 = OID: HOST-RESOURCES-TYPES::hrDeviceProcessor
|
||||
HOST-RESOURCES-MIB::hrDeviceType.7 = OID: HOST-RESOURCES-TYPES::hrDeviceOther
|
||||
HOST-RESOURCES-MIB::hrDeviceType.9 = OID: HOST-RESOURCES-TYPES::hrDeviceVolatileMemory
|
||||
HOST-RESOURCES-MIB::hrDeviceType.10 = OID: HOST-RESOURCES-TYPES::hrDeviceNonVolatileMemory
|
||||
HOST-RESOURCES-MIB::hrDeviceDescr.1 = STRING: Xerox DocuPrint N2025 Network Laser Printer - 2.12-02
|
||||
HOST-RESOURCES-MIB::hrDeviceDescr.2 = STRING: IEEE 1284 port
|
||||
HOST-RESOURCES-MIB::hrDeviceDescr.3 = STRING: Ethernet port
|
||||
HOST-RESOURCES-MIB::hrDeviceDescr.6 = STRING: Motorola Power PC
|
||||
HOST-RESOURCES-MIB::hrDeviceDescr.7 = STRING: USB Port
|
||||
HOST-RESOURCES-MIB::hrDeviceDescr.9 = STRING: RAM Memory
|
||||
HOST-RESOURCES-MIB::hrDeviceDescr.10 = STRING: ROM Memory
|
||||
HOST-RESOURCES-MIB::hrDeviceID.1 = OID: SNMPv2-SMI::enterprises.253.8.62.1.3.2.17.1
|
||||
|
||||
@@ -56,7 +56,9 @@ print_device(const char *uri, /* I - Device URI */
|
||||
const char *resource, /* I - Resource/modelname */
|
||||
const char *options, /* I - Device options/serial number */
|
||||
int fp, /* I - File descriptor to print */
|
||||
int copies) /* I - Copies to print */
|
||||
int copies, /* I - Copies to print */
|
||||
int argc, /* I - Number of command-line arguments (6 or 7) */
|
||||
char *argv[]) /* I - Command-line arguments */
|
||||
{
|
||||
int fd; /* USB device */
|
||||
int rbytes; /* Number of bytes read */
|
||||
@@ -77,6 +79,8 @@ print_device(const char *uri, /* I - Device URI */
|
||||
unsigned int status; /* Port status (off-line, out-of-paper, etc.) */
|
||||
#endif /* __linux */
|
||||
|
||||
(void)argc;
|
||||
(void)argv;
|
||||
|
||||
/*
|
||||
* Open the USB port device...
|
||||
|
||||
@@ -63,7 +63,7 @@
|
||||
void list_devices(void);
|
||||
int print_device(const char *uri, const char *hostname,
|
||||
const char *resource, const char *options,
|
||||
int fp, int copies);
|
||||
int fp, int copies, int argc, char *argv[]);
|
||||
|
||||
|
||||
/*
|
||||
@@ -109,7 +109,9 @@ print_device(const char *uri, /* I - Device URI */
|
||||
const char *resource, /* I - Resource/modelname */
|
||||
const char *options, /* I - Device options/serial number */
|
||||
int fp, /* I - File descriptor to print */
|
||||
int copies) /* I - Copies to print */
|
||||
int copies, /* I - Copies to print */
|
||||
int argc, /* I - Number of command-line arguments (6 or 7) */
|
||||
char *argv[]) /* I - Command-line arguments */
|
||||
{
|
||||
/*
|
||||
* Can't print, so just reference the arguments to eliminate compiler
|
||||
@@ -124,6 +126,8 @@ print_device(const char *uri, /* I - Device URI */
|
||||
(void)options;
|
||||
(void)fp;
|
||||
(void)copies;
|
||||
(void)argc;
|
||||
(void)argv;
|
||||
|
||||
return (CUPS_BACKEND_FAILED);
|
||||
}
|
||||
@@ -251,7 +255,7 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
|
||||
* Finally, send the print file...
|
||||
*/
|
||||
|
||||
status = print_device(uri, hostname, resource, options, fp, copies);
|
||||
status = print_device(uri, hostname, resource, options, fp, copies, argc, argv);
|
||||
|
||||
/*
|
||||
* Close the input file and return...
|
||||
|
||||
@@ -49,6 +49,7 @@
|
||||
* Local functions...
|
||||
*/
|
||||
|
||||
static http_t *connect_server(const char *, http_t *);
|
||||
static int show_jobs(const char *, http_t *, const char *,
|
||||
const char *, const int, const int);
|
||||
static void show_printer(const char *, http_t *, const char *);
|
||||
@@ -76,35 +77,23 @@ main(int argc, /* I - Number of command-line arguments */
|
||||
int num_dests; /* Number of destinations */
|
||||
cups_dest_t *dests; /* Destinations */
|
||||
cups_lang_t *language; /* Language */
|
||||
#ifdef HAVE_SSL
|
||||
http_encryption_t encryption; /* Encryption? */
|
||||
#endif /* HAVE_SSL */
|
||||
|
||||
|
||||
language = cupsLangDefault();
|
||||
|
||||
/*
|
||||
* Connect to the scheduler...
|
||||
*/
|
||||
|
||||
if ((http = httpConnectEncrypt(cupsServer(), ippPort(),
|
||||
cupsEncryption())) == NULL)
|
||||
{
|
||||
_cupsLangPrintf(stderr, _("%s: Unable to contact server!\n"), argv[0]);
|
||||
return (1);
|
||||
}
|
||||
|
||||
/*
|
||||
* Check for command-line options...
|
||||
*/
|
||||
|
||||
http = NULL;
|
||||
dest = NULL;
|
||||
user = NULL;
|
||||
id = 0;
|
||||
interval = 0;
|
||||
longstatus = 0;
|
||||
all = 0;
|
||||
num_dests = cupsGetDests(&dests);
|
||||
language = cupsLangDefault();
|
||||
num_dests = 0;
|
||||
|
||||
for (i = 1; i < argc; i ++)
|
||||
if (argv[i][0] == '+')
|
||||
@@ -115,10 +104,10 @@ main(int argc, /* I - Number of command-line arguments */
|
||||
{
|
||||
case 'E' : /* Encrypt */
|
||||
#ifdef HAVE_SSL
|
||||
encryption = HTTP_ENCRYPT_REQUIRED;
|
||||
cupsSetEncryption(HTTP_ENCRYPT_REQUIRED);
|
||||
|
||||
if (http)
|
||||
httpEncryption(http, encryption);
|
||||
httpEncryption(http, HTTP_ENCRYPT_REQUIRED);
|
||||
#else
|
||||
_cupsLangPrintf(stderr,
|
||||
_("%s: Sorry, no encryption support compiled in!\n"),
|
||||
@@ -166,6 +155,11 @@ main(int argc, /* I - Number of command-line arguments */
|
||||
if ((instance = strchr(dest, '/')) != NULL)
|
||||
*instance++ = '\0';
|
||||
|
||||
http = connect_server(argv[0], http);
|
||||
|
||||
if (num_dests == 0)
|
||||
num_dests = cupsGetDests2(http, &dests);
|
||||
|
||||
if (cupsGetDest(dest, instance, num_dests, dests) == NULL)
|
||||
{
|
||||
if (instance)
|
||||
@@ -186,8 +180,11 @@ main(int argc, /* I - Number of command-line arguments */
|
||||
break;
|
||||
|
||||
case 'h' : /* Connect to host */
|
||||
if (http != NULL)
|
||||
if (http)
|
||||
{
|
||||
httpClose(http);
|
||||
http = NULL;
|
||||
}
|
||||
|
||||
if (argv[i][2] != '\0')
|
||||
cupsSetServer(argv[i] + 2);
|
||||
@@ -225,8 +222,13 @@ main(int argc, /* I - Number of command-line arguments */
|
||||
else
|
||||
user = argv[i];
|
||||
|
||||
http = connect_server(argv[0], http);
|
||||
|
||||
if (dest == NULL && !all)
|
||||
{
|
||||
if (num_dests == 0)
|
||||
num_dests = cupsGetDests2(http, &dests);
|
||||
|
||||
for (i = 0; i < num_dests; i ++)
|
||||
if (dests[i].is_default)
|
||||
dest = dests[i].name;
|
||||
@@ -294,6 +296,30 @@ main(int argc, /* I - Number of command-line arguments */
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'connect_server()' - Connect to the server as necessary...
|
||||
*/
|
||||
|
||||
static http_t * /* O - New HTTP connection */
|
||||
connect_server(const char *command, /* I - Command name */
|
||||
http_t *http) /* I - Current HTTP connection */
|
||||
{
|
||||
if (!http)
|
||||
{
|
||||
http = httpConnectEncrypt(cupsServer(), ippPort(),
|
||||
cupsEncryption());
|
||||
|
||||
if (http == NULL)
|
||||
{
|
||||
_cupsLangPrintf(stderr, _("%s: Unable to connect to server\n"), command);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
return (http);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'show_jobs()' - Show jobs.
|
||||
*/
|
||||
|
||||
@@ -132,12 +132,20 @@ main(int argc, /* I - Number of command-line arguments */
|
||||
if (!strcmp(op, "redirect"))
|
||||
{
|
||||
const char *url; /* Redirection URL... */
|
||||
char prefix[1024]; /* URL prefix */
|
||||
|
||||
|
||||
if (getenv("HTTPS"))
|
||||
snprintf(prefix, sizeof(prefix), "https://%s:%s",
|
||||
getenv("SERVER_NAME"), getenv("SERVER_PORT"));
|
||||
else
|
||||
snprintf(prefix, sizeof(prefix), "http://%s:%s",
|
||||
getenv("SERVER_NAME"), getenv("SERVER_PORT"));
|
||||
|
||||
if ((url = cgiGetVariable("URL")) != NULL)
|
||||
printf("Location: %s\n\n", url);
|
||||
printf("Location: %s%s\n\n", prefix, url);
|
||||
else
|
||||
puts("Location: /admin\n");
|
||||
printf("Location: %s/admin\n\n", prefix);
|
||||
}
|
||||
else if (!strcmp(op, "start-printer"))
|
||||
do_printer_op(http, IPP_RESUME_PRINTER, cgiText(_("Start Printer")));
|
||||
@@ -498,9 +506,7 @@ do_am_printer(http_t *http, /* I - HTTP connection */
|
||||
int modify) /* I - Modify the printer? */
|
||||
{
|
||||
int i; /* Looping var */
|
||||
int element; /* Element number */
|
||||
ipp_attribute_t *attr, /* Current attribute */
|
||||
*last; /* Last attribute */
|
||||
ipp_attribute_t *attr; /* Current attribute */
|
||||
ipp_t *request, /* IPP request */
|
||||
*response, /* IPP response */
|
||||
*oldinfo; /* Old printer information */
|
||||
@@ -847,27 +853,31 @@ do_am_printer(http_t *http, /* I - HTTP connection */
|
||||
* Got the list of PPDs, see if the user has selected a make...
|
||||
*/
|
||||
|
||||
cgiSetIPPVars(response, NULL, NULL, NULL, 0);
|
||||
|
||||
if (var == NULL)
|
||||
if (cgiSetIPPVars(response, NULL, NULL, NULL, 0) == 0)
|
||||
{
|
||||
/*
|
||||
* Let the user choose a make...
|
||||
* No PPD files with this make, try again with all makes...
|
||||
*/
|
||||
|
||||
for (element = 0, attr = response->attrs, last = NULL;
|
||||
attr != NULL;
|
||||
attr = attr->next)
|
||||
if (attr->name && strcmp(attr->name, "ppd-make") == 0)
|
||||
if (last == NULL ||
|
||||
strcasecmp(last->values[0].string.text,
|
||||
attr->values[0].string.text) != 0)
|
||||
{
|
||||
cgiSetArray("PPD_MAKE", element, attr->values[0].string.text);
|
||||
element ++;
|
||||
last = attr;
|
||||
}
|
||||
ippDelete(response);
|
||||
|
||||
request = ippNewRequest(CUPS_GET_PPDS);
|
||||
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri",
|
||||
NULL, "ipp://localhost/printers/");
|
||||
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD,
|
||||
"requested-attributes", NULL, "ppd-make");
|
||||
|
||||
if ((response = cupsDoRequest(http, request, "/")) != NULL)
|
||||
cgiSetIPPVars(response, NULL, NULL, NULL, 0);
|
||||
|
||||
cgiStartHTML(title);
|
||||
cgiCopyTemplateLang("choose-make.tmpl");
|
||||
cgiEndHTML();
|
||||
}
|
||||
else if (!var)
|
||||
{
|
||||
cgiStartHTML(title);
|
||||
cgiCopyTemplateLang("choose-make.tmpl");
|
||||
cgiEndHTML();
|
||||
@@ -923,7 +933,6 @@ do_am_printer(http_t *http, /* I - HTTP connection */
|
||||
cgiEndHTML();
|
||||
}
|
||||
|
||||
|
||||
ippDelete(response);
|
||||
}
|
||||
else
|
||||
@@ -1174,7 +1183,7 @@ do_config_printer(http_t *http) /* I - HTTP connection */
|
||||
|
||||
ppdLocalize(ppd);
|
||||
|
||||
cgiStartHTML("Set Printer Options");
|
||||
cgiStartHTML(cgiText(_("Set Printer Options")));
|
||||
cgiCopyTemplateLang("set-printer-options-header.tmpl");
|
||||
|
||||
if (ppdConflicts(ppd))
|
||||
@@ -1443,7 +1452,7 @@ do_config_printer(http_t *http) /* I - HTTP connection */
|
||||
if (!in || !out)
|
||||
{
|
||||
cgiSetVariable("ERROR", strerror(errno));
|
||||
cgiStartHTML("Set Printer Options");
|
||||
cgiStartHTML(cgiText(_("Set Printer Options")));
|
||||
cgiCopyTemplateLang("error.tmpl");
|
||||
cgiEndHTML();
|
||||
|
||||
@@ -1806,7 +1815,7 @@ do_config_server(http_t *http) /* I - HTTP connection */
|
||||
* Show the current config file...
|
||||
*/
|
||||
|
||||
cgiStartHTML("Edit Configuration File");
|
||||
cgiStartHTML(cgiText(_("Edit Configuration File")));
|
||||
|
||||
printf("<!-- \"%s\" -->\n", filename);
|
||||
|
||||
@@ -1829,10 +1838,13 @@ do_delete_class(http_t *http) /* I - HTTP connection */
|
||||
const char *pclass; /* Printer class name */
|
||||
|
||||
|
||||
cgiStartHTML(cgiText(_("Delete Class")));
|
||||
/*
|
||||
* Get form variables...
|
||||
*/
|
||||
|
||||
if (cgiGetVariable("CONFIRM") == NULL)
|
||||
{
|
||||
cgiStartHTML(cgiText(_("Delete Class")));
|
||||
cgiCopyTemplateLang("class-confirm.tmpl");
|
||||
cgiEndHTML();
|
||||
return;
|
||||
@@ -1843,6 +1855,7 @@ do_delete_class(http_t *http) /* I - HTTP connection */
|
||||
"localhost", 0, "/classes/%s", pclass);
|
||||
else
|
||||
{
|
||||
cgiStartHTML(cgiText(_("Delete Class")));
|
||||
cgiSetVariable("ERROR", cgiText(_("Missing form variable!")));
|
||||
cgiCopyTemplateLang("error.tmpl");
|
||||
cgiEndHTML();
|
||||
@@ -1869,6 +1882,12 @@ do_delete_class(http_t *http) /* I - HTTP connection */
|
||||
|
||||
ippDelete(cupsDoRequest(http, request, "/admin/"));
|
||||
|
||||
/*
|
||||
* Show the results...
|
||||
*/
|
||||
|
||||
cgiStartHTML(cgiText(_("Delete Class")));
|
||||
|
||||
if (cupsLastError() > IPP_OK_CONFLICT)
|
||||
cgiShowIPPError(_("Unable to delete class:"));
|
||||
else
|
||||
@@ -1890,10 +1909,13 @@ do_delete_printer(http_t *http) /* I - HTTP connection */
|
||||
const char *printer; /* Printer printer name */
|
||||
|
||||
|
||||
cgiStartHTML(cgiText(_("Delete Printer")));
|
||||
/*
|
||||
* Get form variables...
|
||||
*/
|
||||
|
||||
if (cgiGetVariable("CONFIRM") == NULL)
|
||||
{
|
||||
cgiStartHTML(cgiText(_("Delete Printer")));
|
||||
cgiCopyTemplateLang("printer-confirm.tmpl");
|
||||
cgiEndHTML();
|
||||
return;
|
||||
@@ -1904,6 +1926,7 @@ do_delete_printer(http_t *http) /* I - HTTP connection */
|
||||
"localhost", 0, "/printers/%s", printer);
|
||||
else
|
||||
{
|
||||
cgiStartHTML(cgiText(_("Delete Printer")));
|
||||
cgiSetVariable("ERROR", cgiText(_("Missing form variable!")));
|
||||
cgiCopyTemplateLang("error.tmpl");
|
||||
cgiEndHTML();
|
||||
@@ -1930,6 +1953,12 @@ do_delete_printer(http_t *http) /* I - HTTP connection */
|
||||
|
||||
ippDelete(cupsDoRequest(http, request, "/admin/"));
|
||||
|
||||
/*
|
||||
* Show the results...
|
||||
*/
|
||||
|
||||
cgiStartHTML(cgiText(_("Delete Printer")));
|
||||
|
||||
if (cupsLastError() > IPP_OK_CONFLICT)
|
||||
cgiShowIPPError(_("Unable to delete printer:"));
|
||||
else
|
||||
|
||||
@@ -1035,9 +1035,9 @@ cgiSetIPPVars(ipp_t *response, /* I - Response data to be copied... */
|
||||
attr = cgiSetIPPObjectVars(attr, prefix, element);
|
||||
}
|
||||
|
||||
fprintf(stderr, "DEBUG2: Returing %d from cgiSetIPPVars()...\n", element + 1);
|
||||
fprintf(stderr, "DEBUG2: Returing %d from cgiSetIPPVars()...\n", element);
|
||||
|
||||
return (element + 1);
|
||||
return (element);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -44,6 +44,7 @@
|
||||
static void cgi_copy(FILE *out, FILE *in, int element, char term,
|
||||
int indent);
|
||||
static void cgi_puts(const char *s, FILE *out);
|
||||
static void cgi_puturi(const char *s, FILE *out);
|
||||
|
||||
|
||||
/*
|
||||
@@ -110,7 +111,7 @@ cgiCopyTemplateLang(const char *tmpl) /* I - Base filename */
|
||||
if ((lang = getenv("LANG")) != NULL)
|
||||
{
|
||||
for (i = 0; lang[i] && i < 15; i ++)
|
||||
if (isalnum(lang[i] & 255))
|
||||
if (isalnum(lang[i] & 255) || lang[i] == '_')
|
||||
locale[i] = tolower(lang[i]);
|
||||
else if (lang[i] == '-')
|
||||
locale[i] = '_';
|
||||
@@ -235,6 +236,7 @@ cgi_copy(FILE *out, /* I - Output file */
|
||||
char outval[1024], /* Formatted output string */
|
||||
compare[1024]; /* Comparison string */
|
||||
int result; /* Result of comparison */
|
||||
int uriencode; /* Encode as URI */
|
||||
|
||||
|
||||
fprintf(stderr, "DEBUG: %*sStarting at file position %ld...\n", indent, "",
|
||||
@@ -253,9 +255,13 @@ cgi_copy(FILE *out, /* I - Output file */
|
||||
* Get a variable name...
|
||||
*/
|
||||
|
||||
uriencode = 0;
|
||||
|
||||
for (s = name; (ch = getc(in)) != EOF;)
|
||||
if (strchr("}]<>=! \t\n", ch))
|
||||
break;
|
||||
else if (s == name && ch == '%')
|
||||
uriencode = 1;
|
||||
else if (s > name && ch == '?')
|
||||
break;
|
||||
else if (s < (name + sizeof(name) - 1))
|
||||
@@ -399,7 +405,12 @@ cgi_copy(FILE *out, /* I - Output file */
|
||||
*/
|
||||
|
||||
if (out)
|
||||
cgi_puts(outptr, out);
|
||||
{
|
||||
if (uriencode)
|
||||
cgi_puturi(outptr, out);
|
||||
else
|
||||
cgi_puts(outptr, out);
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
@@ -637,6 +648,26 @@ cgi_puts(const char *s, /* I - String to output */
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'cgi_puturi()' - Put a URI string to the output file, quoting as needed...
|
||||
*/
|
||||
|
||||
static void
|
||||
cgi_puturi(const char *s, /* I - String to output */
|
||||
FILE *out) /* I - Output file */
|
||||
{
|
||||
while (*s)
|
||||
{
|
||||
if (strchr("%&+ <>#=", *s) || *s & 128)
|
||||
fprintf(out, "%%%02X", *s & 255);
|
||||
else
|
||||
putc(*s, out);
|
||||
|
||||
s ++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* End of "$Id$".
|
||||
*/
|
||||
|
||||
@@ -74,8 +74,7 @@ install: all
|
||||
if test -r $(SERVERROOT)/$$file ; then \
|
||||
$(MV) $(SERVERROOT)/$$file $(SERVERROOT)/$$file.O ; \
|
||||
fi ; \
|
||||
$(INSTALL_CONFIG) $$file $(SERVERROOT) ; \
|
||||
chgrp $(CUPS_GROUP) $(SERVERROOT)/$$file || true; \
|
||||
$(INSTALL_DATA) $$file $(SERVERROOT) ; \
|
||||
done
|
||||
-if test x$(PAMDIR) != x; then \
|
||||
$(INSTALL_DIR) -m 755 $(BUILDROOT)$(PAMDIR); \
|
||||
|
||||
@@ -33,6 +33,7 @@ DefaultAuthType Basic
|
||||
|
||||
# Restrict access to the admin pages...
|
||||
<Location /admin>
|
||||
@ENCRYPTION_REQUIRED@
|
||||
Order allow,deny
|
||||
Allow localhost
|
||||
</Location>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#
|
||||
# "$Id: mime.convs 4559 2005-08-04 18:40:13Z mike $"
|
||||
# "$Id: mime.convs 5402 2006-04-14 19:21:03Z mike $"
|
||||
#
|
||||
# MIME converts file for the Common UNIX Printing System (CUPS).
|
||||
#
|
||||
@@ -107,13 +107,12 @@ image/x-sun-raster application/vnd.cups-raster 100 imagetoraster
|
||||
#
|
||||
# Raw filter...
|
||||
#
|
||||
# Uncomment the following filter and the application/octet-stream type
|
||||
# in mime.types to allow printing of arbitrary files without the -oraw
|
||||
# option.
|
||||
# Uncomment the following filter to allow printing of arbitrary files
|
||||
# without the -oraw option.
|
||||
#
|
||||
|
||||
#application/octet-stream application/vnd.cups-raw 0 -
|
||||
|
||||
#
|
||||
# End of "$Id: mime.convs 4559 2005-08-04 18:40:13Z mike $".
|
||||
# End of "$Id: mime.convs 5402 2006-04-14 19:21:03Z mike $".
|
||||
#
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#
|
||||
# "$Id: mime.types 4590 2005-08-24 19:25:49Z mike $"
|
||||
# "$Id: mime.types 5402 2006-04-14 19:21:03Z mike $"
|
||||
#
|
||||
# MIME types file for the Common UNIX Printing System (CUPS).
|
||||
#
|
||||
@@ -77,7 +77,9 @@ application/postscript ai eps ps string(0,%!) string(0,<04>%!) \
|
||||
(contains(0,1024,"LANGUAGE=POSTSCRIPT") \
|
||||
contains(0,1024,"LANGUAGE = Postscript") \
|
||||
contains(0,1024,"LANGUAGE = PostScript") \
|
||||
contains(0,1024,"LANGUAGE = POSTSCRIPT"))
|
||||
contains(0,1024,"LANGUAGE = POSTSCRIPT") \
|
||||
(contains(0,1024,<0a>%!) + \
|
||||
!contains(0,1024,"ENTER LANGUAGE")))
|
||||
application/vnd.hp-HPGL hpgl string(0,<1B>&)\
|
||||
string(0,<1B>E<1B>%0B) \
|
||||
string(0,<1B>%-1B) string(0,<201B>)\
|
||||
@@ -145,7 +147,9 @@ text/css css
|
||||
|
||||
application/vnd.cups-command string(0,'#CUPS-COMMAND')
|
||||
application/vnd.cups-form string(0,"<CUPSFORM>")
|
||||
application/vnd.cups-pdf
|
||||
application/vnd.cups-postscript
|
||||
application/vnd.cups-ppd ppd string(0,"*PPD-Adobe:")
|
||||
application/vnd.cups-raster string(0,"RaSt") string(0,"tSaR")
|
||||
application/vnd.cups-raw (string(0,<1B>E) + !string(2,<1B>%0B)) \
|
||||
string(0,<1B>@) \
|
||||
@@ -157,13 +161,11 @@ application/vnd.cups-raw (string(0,<1B>E) + !string(2,<1B>%0B)) \
|
||||
#
|
||||
# Raw print file support...
|
||||
#
|
||||
# Uncomment the following type and the application/octet-stream
|
||||
# filter line in mime.convs to allow raw file printing without the
|
||||
# -oraw option.
|
||||
# Comment the following type to prevent raw file printing.
|
||||
#
|
||||
|
||||
#application/octet-stream
|
||||
application/octet-stream
|
||||
|
||||
#
|
||||
# End of "$Id: mime.types 4590 2005-08-24 19:25:49Z mike $".
|
||||
# End of "$Id: mime.types 5402 2006-04-14 19:21:03Z mike $".
|
||||
#
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
dnl
|
||||
dnl "$Id: cups-common.m4 5288 2006-03-14 02:38:07Z mike $"
|
||||
dnl "$Id: cups-common.m4 5466 2006-04-26 19:52:27Z mike $"
|
||||
dnl
|
||||
dnl Common configuration stuff for the Common UNIX Printing System (CUPS).
|
||||
dnl
|
||||
@@ -79,9 +79,10 @@ fi
|
||||
|
||||
dnl Static library option...
|
||||
INSTALLSTATIC=""
|
||||
AC_ARG_ENABLE(install_static, [ --enable-static install static libraries, default=no])
|
||||
AC_ARG_ENABLE(static, [ --enable-static install static libraries, default=no])
|
||||
|
||||
if test x$enable_install_static = xyes; then
|
||||
if test x$enable_static = xyes; then
|
||||
echo Installing static libraries...
|
||||
INSTALLSTATIC="installstatic"
|
||||
fi
|
||||
|
||||
@@ -264,5 +265,5 @@ AC_SUBST(DEFAULT_IPP_PORT)
|
||||
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_IPP_PORT,$DEFAULT_IPP_PORT)
|
||||
|
||||
dnl
|
||||
dnl End of "$Id: cups-common.m4 5288 2006-03-14 02:38:07Z mike $".
|
||||
dnl End of "$Id: cups-common.m4 5466 2006-04-26 19:52:27Z mike $".
|
||||
dnl
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
dnl
|
||||
dnl "$Id: cups-compiler.m4 5288 2006-03-14 02:38:07Z mike $"
|
||||
dnl "$Id: cups-compiler.m4 5473 2006-05-01 15:51:09Z mike $"
|
||||
dnl
|
||||
dnl Compiler stuff for the Common UNIX Printing System (CUPS).
|
||||
dnl
|
||||
@@ -73,12 +73,15 @@ AC_SUBST(LIB64DIR)
|
||||
AC_SUBST(UNINSTALL64)
|
||||
|
||||
dnl Position-Independent Executable support on Linux and *BSD...
|
||||
AC_ARG_ENABLE(pie, [ --enable-pie use GCC -fpie option, default=no])
|
||||
AC_ARG_ENABLE(pie, [ --enable-pie use GCC -fPIE option, default=no])
|
||||
|
||||
dnl Update compiler options...
|
||||
CXXLIBS=""
|
||||
AC_SUBST(CXXLIBS)
|
||||
|
||||
PIEFLAGS=""
|
||||
AC_SUBST(PIEFLAGS)
|
||||
|
||||
if test -n "$GCC"; then
|
||||
if test -z "$OPTIM"; then
|
||||
if test "x$with_optim" = x; then
|
||||
@@ -96,8 +99,13 @@ if test -n "$GCC"; then
|
||||
case $uname in
|
||||
Linux*)
|
||||
if test x$enable_pie = xyes; then
|
||||
OPTIM="$OPTIM -fpie"
|
||||
LDFLAGS="$LDFLAGS -pie"
|
||||
PIEFLAGS="-pie -fPIE"
|
||||
fi
|
||||
;;
|
||||
|
||||
*)
|
||||
if test x$enable_pie = xyes; then
|
||||
echo "Sorry, --enable-pie is not supported on this OS!"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
@@ -467,5 +475,5 @@ if test $uname = HP-UX; then
|
||||
fi
|
||||
|
||||
dnl
|
||||
dnl End of "$Id: cups-compiler.m4 5288 2006-03-14 02:38:07Z mike $".
|
||||
dnl End of "$Id: cups-compiler.m4 5473 2006-05-01 15:51:09Z mike $".
|
||||
dnl
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
dnl
|
||||
dnl "$Id$"
|
||||
dnl "$Id: cups-defaults.m4 5466 2006-04-26 19:52:27Z mike $"
|
||||
dnl
|
||||
dnl Default cupsd configuration settings for the Common UNIX Printing System
|
||||
dnl (CUPS).
|
||||
@@ -26,7 +26,7 @@ dnl
|
||||
dnl Default langugages...
|
||||
AC_ARG_WITH(languages, [ --with-languages set installed languages, default="es ja" ],
|
||||
LANGUAGES="$withval",
|
||||
LANGUAGES="es ja")
|
||||
LANGUAGES="es ja pl sv")
|
||||
AC_SUBST(LANGUAGES)
|
||||
|
||||
dnl Default ConfigFilePerm
|
||||
@@ -111,13 +111,21 @@ AC_SUBST(CUPS_IMPLICIT_CLASSES)
|
||||
|
||||
dnl Default UseNetworkDefault
|
||||
AC_ARG_ENABLE(network_default, [ --enable-use-network-default
|
||||
enable UseNetworkDefault by default, default=yes])
|
||||
if test "x$enable_network_default" = xno; then
|
||||
enable UseNetworkDefault by default, default=auto])
|
||||
if test "x$enable_network_default" != xno; then
|
||||
AC_MSG_CHECKING(whether to use network default printers)
|
||||
if test "x$enable_network_default" = xyes -o $uname != Darwin; then
|
||||
CUPS_USE_NETWORK_DEFAULT="Yes"
|
||||
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_USE_NETWORK_DEFAULT, 1)
|
||||
AC_MSG_RESULT(yes)
|
||||
else
|
||||
CUPS_USE_NETWORK_DEFAULT="No"
|
||||
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_USE_NETWORK_DEFAULT, 0)
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
else
|
||||
CUPS_USE_NETWORK_DEFAULT="No"
|
||||
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_USE_NETWORK_DEFAULT, 0)
|
||||
else
|
||||
CUPS_USE_NETWORK_DEFAULT="Yes"
|
||||
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_USE_NETWORK_DEFAULT, 1)
|
||||
fi
|
||||
AC_SUBST(CUPS_USE_NETWORK_DEFAULT)
|
||||
|
||||
@@ -148,12 +156,7 @@ AC_ARG_WITH(cups-group, [ --with-cups-group set default group for CUPS],
|
||||
CUPS_GROUP="$withval",
|
||||
AC_MSG_CHECKING(for default print group)
|
||||
if test -f /etc/group; then
|
||||
if test x$uname = xDarwin; then
|
||||
GROUP_LIST="nobody"
|
||||
else
|
||||
GROUP_LIST="lp nobody"
|
||||
fi
|
||||
|
||||
GROUP_LIST="lp nobody"
|
||||
CUPS_GROUP=""
|
||||
for group in $GROUP_LIST; do
|
||||
if test "`grep \^${group}: /etc/group`" != ""; then
|
||||
@@ -215,7 +218,23 @@ AC_DEFINE_UNQUOTED(CUPS_DEFAULT_USER, "$CUPS_USER")
|
||||
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_GROUP, "$CUPS_GROUP")
|
||||
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_SYSTEM_GROUPS, "$CUPS_SYSTEM_GROUPS")
|
||||
|
||||
dnl Default printcap file...
|
||||
AC_ARG_WITH(printcap, [ --with-printcap set default printcap file],
|
||||
default_printcap="$withval",
|
||||
default_printcap="/etc/printcap")
|
||||
|
||||
if test x$enable_printcap != xno -a x$default_printcap != xno; then
|
||||
if test "x$default_printcap" = "x/etc/printcap" -a "$uname" = "Darwin" -a $uversion -ge 90; then
|
||||
CUPS_DEFAULT_PRINTCAP=""
|
||||
else
|
||||
CUPS_DEFAULT_PRINTCAP="$default_printcap"
|
||||
fi
|
||||
else
|
||||
CUPS_DEFAULT_PRINTCAP=""
|
||||
fi
|
||||
|
||||
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_PRINTCAP, "$CUPS_DEFAULT_PRINTCAP")
|
||||
|
||||
dnl
|
||||
dnl End of "$Id$".
|
||||
dnl End of "$Id: cups-defaults.m4 5466 2006-04-26 19:52:27Z mike $".
|
||||
dnl
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
dnl
|
||||
dnl "$Id: cups-directories.m4 5314 2006-03-20 19:06:50Z mike $"
|
||||
dnl "$Id: cups-directories.m4 5466 2006-04-26 19:52:27Z mike $"
|
||||
dnl
|
||||
dnl Directory stuff for the Common UNIX Printing System (CUPS).
|
||||
dnl
|
||||
@@ -300,5 +300,5 @@ AC_DEFINE_UNQUOTED(CUPS_STATEDIR, "$localstatedir/run/cups")
|
||||
AC_SUBST(CUPS_STATEDIR)
|
||||
|
||||
dnl
|
||||
dnl End of "$Id: cups-directories.m4 5314 2006-03-20 19:06:50Z mike $".
|
||||
dnl End of "$Id: cups-directories.m4 5466 2006-04-26 19:52:27Z mike $".
|
||||
dnl
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
dnl
|
||||
dnl "$Id: cups-image.m4 5311 2006-03-19 13:21:42Z mike $"
|
||||
dnl "$Id: cups-image.m4 5466 2006-04-26 19:52:27Z mike $"
|
||||
dnl
|
||||
dnl Image library/filter stuff for the Common UNIX Printing System (CUPS).
|
||||
dnl
|
||||
@@ -78,7 +78,7 @@ AC_CHECK_LIB(m, pow)
|
||||
|
||||
if test x$enable_png != xno; then
|
||||
AC_CHECK_HEADER(png.h,
|
||||
AC_CHECK_LIB(png, png_set_tRNS_to_alpha,
|
||||
AC_CHECK_LIB(png, png_create_read_struct,
|
||||
AC_DEFINE(HAVE_LIBPNG)
|
||||
LIBPNG="-lpng -lm"))
|
||||
else
|
||||
@@ -110,5 +110,5 @@ AC_SUBST(EXPORT_LIBZ)
|
||||
AC_CHECK_HEADER(stdlib.h,AC_DEFINE(HAVE_STDLIB_H))
|
||||
|
||||
dnl
|
||||
dnl End of "$Id: cups-image.m4 5311 2006-03-19 13:21:42Z mike $".
|
||||
dnl End of "$Id: cups-image.m4 5466 2006-04-26 19:52:27Z mike $".
|
||||
dnl
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
dnl
|
||||
dnl "$Id$"
|
||||
dnl "$Id: cups-launchd.m4 5466 2006-04-26 19:52:27Z mike $"
|
||||
dnl
|
||||
dnl launchd stuff for the Common UNIX Printing System (CUPS).
|
||||
dnl
|
||||
@@ -49,5 +49,5 @@ AC_SUBST(DEFAULT_LAUNCHD_CONF)
|
||||
AC_SUBST(LAUNCHDLIBS)
|
||||
|
||||
dnl
|
||||
dnl End of "$Id$".
|
||||
dnl End of "$Id: cups-launchd.m4 5466 2006-04-26 19:52:27Z mike $".
|
||||
dnl
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
dnl
|
||||
dnl "$Id$"
|
||||
dnl "$Id: cups-ldap.m4 5466 2006-04-26 19:52:27Z mike $"
|
||||
dnl
|
||||
dnl LDAP configuration stuff for the Common UNIX Printing System (CUPS).
|
||||
dnl
|
||||
@@ -46,5 +46,5 @@ AC_SUBST(LIBLDAP)
|
||||
|
||||
|
||||
dnl
|
||||
dnl End of "$Id$".
|
||||
dnl End of "$Id: cups-ldap.m4 5466 2006-04-26 19:52:27Z mike $".
|
||||
dnl
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
dnl
|
||||
dnl "$Id: cups-libtool.m4 4494 2005-02-18 02:18:11Z mike $"
|
||||
dnl "$Id: cups-libtool.m4 5466 2006-04-26 19:52:27Z mike $"
|
||||
dnl
|
||||
dnl Libtool stuff for the Common UNIX Printing System (CUPS).
|
||||
dnl
|
||||
@@ -45,5 +45,5 @@ if test x$LIBTOOL != x; then
|
||||
fi
|
||||
|
||||
dnl
|
||||
dnl End of "$Id: cups-libtool.m4 4494 2005-02-18 02:18:11Z mike $".
|
||||
dnl End of "$Id: cups-libtool.m4 5466 2006-04-26 19:52:27Z mike $".
|
||||
dnl
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
dnl
|
||||
dnl "$Id: cups-manpages.m4 5099 2006-02-13 02:46:10Z mike $"
|
||||
dnl "$Id: cups-manpages.m4 5466 2006-04-26 19:52:27Z mike $"
|
||||
dnl
|
||||
dnl Manpage stuff for the Common UNIX Printing System (CUPS).
|
||||
dnl
|
||||
@@ -103,5 +103,5 @@ AC_SUBST(MAN8EXT)
|
||||
AC_SUBST(MAN8DIR)
|
||||
|
||||
dnl
|
||||
dnl End of "$Id: cups-manpages.m4 5099 2006-02-13 02:46:10Z mike $".
|
||||
dnl End of "$Id: cups-manpages.m4 5466 2006-04-26 19:52:27Z mike $".
|
||||
dnl
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
dnl
|
||||
dnl "$Id: cups-network.m4 4873 2005-12-07 01:46:54Z mike $"
|
||||
dnl "$Id: cups-network.m4 5466 2006-04-26 19:52:27Z mike $"
|
||||
dnl
|
||||
dnl Networking stuff for the Common UNIX Printing System (CUPS).
|
||||
dnl
|
||||
@@ -85,5 +85,5 @@ AC_SUBST(CUPS_DEFAULT_DOMAINSOCKET)
|
||||
AC_SUBST(CUPS_LISTEN_DOMAINSOCKET)
|
||||
|
||||
dnl
|
||||
dnl End of "$Id: cups-network.m4 4873 2005-12-07 01:46:54Z mike $".
|
||||
dnl End of "$Id: cups-network.m4 5466 2006-04-26 19:52:27Z mike $".
|
||||
dnl
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
dnl
|
||||
dnl "$Id: cups-opsys.m4 5075 2006-02-05 01:00:29Z mike $"
|
||||
dnl "$Id: cups-opsys.m4 5466 2006-04-26 19:52:27Z mike $"
|
||||
dnl
|
||||
dnl Operating system stuff for the Common UNIX Printing System (CUPS).
|
||||
dnl
|
||||
@@ -39,5 +39,5 @@ case "$uname" in
|
||||
esac
|
||||
|
||||
dnl
|
||||
dnl "$Id: cups-opsys.m4 5075 2006-02-05 01:00:29Z mike $"
|
||||
dnl "$Id: cups-opsys.m4 5466 2006-04-26 19:52:27Z mike $"
|
||||
dnl
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
dnl
|
||||
dnl "$Id: cups-pam.m4 4913 2006-01-11 01:42:04Z mike $"
|
||||
dnl "$Id: cups-pam.m4 5466 2006-04-26 19:52:27Z mike $"
|
||||
dnl
|
||||
dnl PAM stuff for the Common UNIX Printing System (CUPS).
|
||||
dnl
|
||||
@@ -94,5 +94,5 @@ AC_SUBST(PAMLIBS)
|
||||
AC_SUBST(PAMMOD)
|
||||
|
||||
dnl
|
||||
dnl End of "$Id: cups-pam.m4 4913 2006-01-11 01:42:04Z mike $".
|
||||
dnl End of "$Id: cups-pam.m4 5466 2006-04-26 19:52:27Z mike $".
|
||||
dnl
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
dnl
|
||||
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 2006 by Easy Software Products, all rights reserved.
|
||||
dnl
|
||||
dnl These coded instructions, statements, and computer programs are the
|
||||
dnl property of Easy Software Products and are protected by Federal
|
||||
dnl copyright law. Distribution and use rights are outlined in the file
|
||||
dnl "LICENSE.txt" which should have been included with this file. If this
|
||||
dnl file is missing or damaged please contact Easy Software Products
|
||||
dnl at:
|
||||
dnl
|
||||
dnl Attn: CUPS Licensing Information
|
||||
dnl Easy Software Products
|
||||
dnl 44141 Airport View Drive, Suite 204
|
||||
dnl Hollywood, Maryland 20636 USA
|
||||
dnl
|
||||
dnl Voice: (301) 373-9600
|
||||
dnl EMail: cups-info@cups.org
|
||||
dnl WWW: http://www.cups.org
|
||||
dnl
|
||||
|
||||
# Currently the PAP backend is only supported on MacOS X with the AppleTalk
|
||||
# SDK installed...
|
||||
PAP=""
|
||||
if test $uname = Darwin; then
|
||||
PAP="pap"
|
||||
AC_CHECK_HEADER(AppleTalk/at_proto.h)
|
||||
fi
|
||||
|
||||
AC_SUBST(PAP)
|
||||
|
||||
dnl
|
||||
dnl End of "$Id: cups-pam.m4 5466 2006-04-26 19:52:27Z mike $".
|
||||
dnl
|
||||
@@ -1,5 +1,5 @@
|
||||
dnl
|
||||
dnl "$Id$"
|
||||
dnl "$Id: cups-pdf.m4 5466 2006-04-26 19:52:27Z mike $"
|
||||
dnl
|
||||
dnl PDF filter configuration stuff for the Common UNIX Printing System (CUPS).
|
||||
dnl
|
||||
@@ -39,5 +39,5 @@ fi
|
||||
AC_SUBST(PDFTOPS)
|
||||
|
||||
dnl
|
||||
dnl End of "$Id$".
|
||||
dnl End of "$Id: cups-pdf.m4 5466 2006-04-26 19:52:27Z mike $".
|
||||
dnl
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
dnl
|
||||
dnl "$Id: cups-scripting.m4 5176 2006-02-25 18:14:10Z mike $"
|
||||
dnl "$Id: cups-scripting.m4 5466 2006-04-26 19:52:27Z mike $"
|
||||
dnl
|
||||
dnl Scripting configuration stuff for the Common UNIX Printing System (CUPS).
|
||||
dnl
|
||||
@@ -100,5 +100,5 @@ if test "x$CUPS_PYTHON" != x; then
|
||||
fi
|
||||
|
||||
dnl
|
||||
dnl End of "$Id: cups-scripting.m4 5176 2006-02-25 18:14:10Z mike $".
|
||||
dnl End of "$Id: cups-scripting.m4 5466 2006-04-26 19:52:27Z mike $".
|
||||
dnl
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
dnl
|
||||
dnl "$Id: cups-sharedlibs.m4 5112 2006-02-16 04:41:59Z mike $"
|
||||
dnl "$Id: cups-sharedlibs.m4 5466 2006-04-26 19:52:27Z mike $"
|
||||
dnl
|
||||
dnl Shared library support for the Common UNIX Printing System (CUPS).
|
||||
dnl
|
||||
@@ -152,5 +152,5 @@ AC_SUBST(IMGLIBS)
|
||||
AC_SUBST(EXPORT_LDFLAGS)
|
||||
|
||||
dnl
|
||||
dnl End of "$Id: cups-sharedlibs.m4 5112 2006-02-16 04:41:59Z mike $".
|
||||
dnl End of "$Id: cups-sharedlibs.m4 5466 2006-04-26 19:52:27Z mike $".
|
||||
dnl
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
dnl
|
||||
dnl "$Id: cups-openslp.m4 4494 2005-02-18 02:18:11Z mike $"
|
||||
dnl "$Id: cups-slp.m4 5466 2006-04-26 19:52:27Z mike $"
|
||||
dnl
|
||||
dnl OpenSLP configuration stuff for the Common UNIX Printing System (CUPS).
|
||||
dnl
|
||||
@@ -44,5 +44,5 @@ AC_SUBST(LIBSLP)
|
||||
|
||||
|
||||
dnl
|
||||
dnl End of "$Id: cups-openslp.m4 4494 2005-02-18 02:18:11Z mike $".
|
||||
dnl End of "$Id: cups-slp.m4 5466 2006-04-26 19:52:27Z mike $".
|
||||
dnl
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
dnl
|
||||
dnl "$Id: cups-ssl.m4 5264 2006-03-10 01:10:36Z mike $"
|
||||
dnl "$Id: cups-ssl.m4 5466 2006-04-26 19:52:27Z mike $"
|
||||
dnl
|
||||
dnl OpenSSL/GNUTLS stuff for the Common UNIX Printing System (CUPS).
|
||||
dnl
|
||||
dnl Copyright 1997-2005 by Easy Software Products, all rights reserved.
|
||||
dnl Copyright 1997-2006 by Easy Software Products, all rights reserved.
|
||||
dnl
|
||||
dnl These coded instructions, statements, and computer programs are the
|
||||
dnl property of Easy Software Products and are protected by Federal
|
||||
@@ -36,6 +36,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...
|
||||
@@ -43,6 +44,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)])
|
||||
fi
|
||||
@@ -57,6 +62,7 @@ if test x$enable_ssl != xno; then
|
||||
|
||||
AC_CHECK_LIB(gnutls, gnutls_x509_crt_set_dn_by_oid,
|
||||
[SSLLIBS="-lgnutls"
|
||||
ENCRYPTION_REQUIRED=" Encryption Required"
|
||||
AC_DEFINE(HAVE_SSL)
|
||||
AC_DEFINE(HAVE_GNUTLS)])
|
||||
|
||||
@@ -84,6 +90,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)
|
||||
@@ -99,11 +106,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 5264 2006-03-10 01:10:36Z mike $".
|
||||
dnl End of "$Id: cups-ssl.m4 5466 2006-04-26 19:52:27Z mike $".
|
||||
dnl
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
dnl
|
||||
dnl "$Id$"
|
||||
dnl "$Id: cups-threads.m4 5466 2006-04-26 19:52:27Z mike $"
|
||||
dnl
|
||||
dnl Threading stuff for the Common UNIX Printing System (CUPS).
|
||||
dnl
|
||||
@@ -53,5 +53,5 @@ fi
|
||||
AC_SUBST(PTHREAD_FLAGS)
|
||||
|
||||
dnl
|
||||
dnl End of "$Id$".
|
||||
dnl End of "$Id: cups-threads.m4 5466 2006-04-26 19:52:27Z mike $".
|
||||
dnl
|
||||
|
||||
@@ -70,6 +70,13 @@
|
||||
#define CUPS_DEFAULT_IPP_PORT 631
|
||||
|
||||
|
||||
/*
|
||||
* Default printcap file...
|
||||
*/
|
||||
|
||||
#define CUPS_DEFAULT_PRINTCAP "/etc/printcap"
|
||||
|
||||
|
||||
/*
|
||||
* Maximum number of file descriptors to support.
|
||||
*/
|
||||
@@ -422,6 +429,13 @@
|
||||
#undef HAVE_DBUS
|
||||
|
||||
|
||||
/*
|
||||
* Do we have the AppleTalk/at_proto.h header?
|
||||
*/
|
||||
|
||||
#undef HAVE_APPLETALK_AT_PROTO_H
|
||||
|
||||
|
||||
#endif /* !_CUPS_CONFIG_H_ */
|
||||
|
||||
/*
|
||||
|
||||
@@ -26,7 +26,6 @@ AC_INIT(cups/cups.h)
|
||||
|
||||
sinclude(config-scripts/cups-opsys.m4)
|
||||
sinclude(config-scripts/cups-common.m4)
|
||||
sinclude(config-scripts/cups-defaults.m4)
|
||||
sinclude(config-scripts/cups-directories.m4)
|
||||
sinclude(config-scripts/cups-manpages.m4)
|
||||
|
||||
@@ -43,18 +42,28 @@ sinclude(config-scripts/cups-pam.m4)
|
||||
sinclude(config-scripts/cups-threads.m4)
|
||||
sinclude(config-scripts/cups-largefile.m4)
|
||||
sinclude(config-scripts/cups-launchd.m4)
|
||||
sinclude(config-scripts/cups-defaults.m4)
|
||||
sinclude(config-scripts/cups-pap.m4)
|
||||
sinclude(config-scripts/cups-pdf.m4)
|
||||
sinclude(config-scripts/cups-scripting.m4)
|
||||
|
||||
LANGFILES=""
|
||||
if test "x$LANGUAGES" != x; then
|
||||
for lang in $LANGUAGES; do
|
||||
LANGFILES="$LANGFILES doc/$lang/index.html"
|
||||
LANGFILES="$LANGFILES templates/$lang/edit-config.tmpl"
|
||||
LANGFILES="$LANGFILES templates/$lang/header.tmpl"
|
||||
done
|
||||
fi
|
||||
|
||||
AC_OUTPUT(Makedefs packaging/cups.list init/cups.sh init/cups-lpd cups-config
|
||||
conf/cupsd.conf conf/pam.std doc/index.html
|
||||
doc/es/index.html doc/ja/index.html
|
||||
doc/help/standard.html man/client.conf.man
|
||||
man/cups-deviced.man man/cups-driverd.man
|
||||
man/cups-lpd.man man/cupsaddsmb.man man/cupsd.man
|
||||
man/cupsd.conf.man man/lpoptions.man
|
||||
templates/edit-config.tmpl templates/header.tmpl
|
||||
templates/es/header.tmpl templates/ja/header.tmpl)
|
||||
$LANGFILES)
|
||||
|
||||
chmod +x cups-config
|
||||
|
||||
|
||||
@@ -20,11 +20,12 @@ encode.o: ipp-private.h string.h ../config.h debug.h
|
||||
file.o: http-private.h ../config.h http.h md5.h ipp-private.h ipp.h globals.h
|
||||
file.o: string.h cups.h ppd.h array.h file.h language.h i18n.h transcode.h
|
||||
file.o: debug.h
|
||||
getifaddrs.o: http-private.h ../config.h http.h md5.h ipp-private.h ipp.h
|
||||
getputfile.o: cups.h ipp.h http.h md5.h ppd.h array.h file.h language.h
|
||||
getputfile.o: string.h ../config.h debug.h
|
||||
globals.o: http-private.h ../config.h http.h md5.h ipp-private.h ipp.h
|
||||
globals.o: globals.h string.h cups.h ppd.h array.h file.h language.h i18n.h
|
||||
globals.o: transcode.h
|
||||
globals.o: transcode.h debug.h
|
||||
http.o: http-private.h ../config.h http.h md5.h ipp-private.h ipp.h globals.h
|
||||
http.o: string.h cups.h ppd.h array.h file.h language.h i18n.h transcode.h
|
||||
http.o: debug.h
|
||||
@@ -60,8 +61,7 @@ ppd.o: file.h language.h i18n.h transcode.h debug.h
|
||||
request.o: globals.h string.h ../config.h cups.h ipp.h http.h md5.h ppd.h
|
||||
request.o: array.h file.h language.h i18n.h transcode.h debug.h
|
||||
snprintf.o: string.h ../config.h
|
||||
string.o: debug.h string.h ../config.h globals.h cups.h ipp.h http.h md5.h
|
||||
string.o: ppd.h array.h file.h language.h i18n.h transcode.h
|
||||
string.o: array.h debug.h string.h ../config.h
|
||||
tempfile.o: globals.h string.h ../config.h cups.h ipp.h http.h md5.h ppd.h
|
||||
tempfile.o: array.h file.h language.h i18n.h transcode.h debug.h
|
||||
transcode.o: globals.h string.h ../config.h cups.h ipp.h http.h md5.h ppd.h
|
||||
@@ -102,11 +102,12 @@ encode.32.o: encode.c ipp-private.h string.h ../config.h debug.h
|
||||
file.32.o: file.c http-private.h ../config.h http.h md5.h ipp-private.h ipp.h globals.h
|
||||
file.32.o: file.c string.h cups.h ppd.h array.h file.h language.h i18n.h transcode.h
|
||||
file.32.o: file.c debug.h
|
||||
getifaddrs.32.o: getifaddrs.c http-private.h ../config.h http.h md5.h ipp-private.h ipp.h
|
||||
getputfile.32.o: getputfile.c cups.h ipp.h http.h md5.h ppd.h array.h file.h language.h
|
||||
getputfile.32.o: getputfile.c string.h ../config.h debug.h
|
||||
globals.32.o: globals.c http-private.h ../config.h http.h md5.h ipp-private.h ipp.h
|
||||
globals.32.o: globals.c globals.h string.h cups.h ppd.h array.h file.h language.h i18n.h
|
||||
globals.32.o: globals.c transcode.h
|
||||
globals.32.o: globals.c transcode.h debug.h
|
||||
http.32.o: http.c http-private.h ../config.h http.h md5.h ipp-private.h ipp.h globals.h
|
||||
http.32.o: http.c string.h cups.h ppd.h array.h file.h language.h i18n.h transcode.h
|
||||
http.32.o: http.c debug.h
|
||||
@@ -142,8 +143,7 @@ ppd.32.o: ppd.c file.h language.h i18n.h transcode.h debug.h
|
||||
request.32.o: request.c globals.h string.h ../config.h cups.h ipp.h http.h md5.h ppd.h
|
||||
request.32.o: request.c array.h file.h language.h i18n.h transcode.h debug.h
|
||||
snprintf.32.o: snprintf.c string.h ../config.h
|
||||
string.32.o: string.c debug.h string.h ../config.h globals.h cups.h ipp.h http.h md5.h
|
||||
string.32.o: string.c ppd.h array.h file.h language.h i18n.h transcode.h
|
||||
string.32.o: string.c array.h debug.h string.h ../config.h
|
||||
tempfile.32.o: tempfile.c globals.h string.h ../config.h cups.h ipp.h http.h md5.h ppd.h
|
||||
tempfile.32.o: tempfile.c array.h file.h language.h i18n.h transcode.h debug.h
|
||||
transcode.32.o: transcode.c globals.h string.h ../config.h cups.h ipp.h http.h md5.h ppd.h
|
||||
@@ -184,11 +184,12 @@ encode.64.o: encode.c ipp-private.h string.h ../config.h debug.h
|
||||
file.64.o: file.c http-private.h ../config.h http.h md5.h ipp-private.h ipp.h globals.h
|
||||
file.64.o: file.c string.h cups.h ppd.h array.h file.h language.h i18n.h transcode.h
|
||||
file.64.o: file.c debug.h
|
||||
getifaddrs.64.o: getifaddrs.c http-private.h ../config.h http.h md5.h ipp-private.h ipp.h
|
||||
getputfile.64.o: getputfile.c cups.h ipp.h http.h md5.h ppd.h array.h file.h language.h
|
||||
getputfile.64.o: getputfile.c string.h ../config.h debug.h
|
||||
globals.64.o: globals.c http-private.h ../config.h http.h md5.h ipp-private.h ipp.h
|
||||
globals.64.o: globals.c globals.h string.h cups.h ppd.h array.h file.h language.h i18n.h
|
||||
globals.64.o: globals.c transcode.h
|
||||
globals.64.o: globals.c transcode.h debug.h
|
||||
http.64.o: http.c http-private.h ../config.h http.h md5.h ipp-private.h ipp.h globals.h
|
||||
http.64.o: http.c string.h cups.h ppd.h array.h file.h language.h i18n.h transcode.h
|
||||
http.64.o: http.c debug.h
|
||||
@@ -224,8 +225,7 @@ ppd.64.o: ppd.c file.h language.h i18n.h transcode.h debug.h
|
||||
request.64.o: request.c globals.h string.h ../config.h cups.h ipp.h http.h md5.h ppd.h
|
||||
request.64.o: request.c array.h file.h language.h i18n.h transcode.h debug.h
|
||||
snprintf.64.o: snprintf.c string.h ../config.h
|
||||
string.64.o: string.c debug.h string.h ../config.h globals.h cups.h ipp.h http.h md5.h
|
||||
string.64.o: string.c ppd.h array.h file.h language.h i18n.h transcode.h
|
||||
string.64.o: string.c array.h debug.h string.h ../config.h
|
||||
tempfile.64.o: tempfile.c globals.h string.h ../config.h cups.h ipp.h http.h md5.h ppd.h
|
||||
tempfile.64.o: tempfile.c array.h file.h language.h i18n.h transcode.h debug.h
|
||||
transcode.64.o: transcode.c globals.h string.h ../config.h cups.h ipp.h http.h md5.h ppd.h
|
||||
|
||||
@@ -43,6 +43,7 @@ LIBOBJS = \
|
||||
emit.o \
|
||||
encode.o \
|
||||
file.o \
|
||||
getifaddrs.o \
|
||||
getputfile.o \
|
||||
globals.o \
|
||||
http.o \
|
||||
@@ -172,10 +173,8 @@ install: all installhdrs $(INSTALLSTATIC) $(INSTALL32) $(INSTALL64)
|
||||
|
||||
installstatic:
|
||||
$(INSTALL_DIR) -m 755 $(LIBDIR)
|
||||
if test $(LIBCUPS) != "libcups.a"; then \
|
||||
$(INSTALL_LIB) libcups.a $(LIBDIR); \
|
||||
$(RANLIB) $(LIBDIR)/libcups.a; \
|
||||
fi
|
||||
$(INSTALL_LIB) libcups.a $(LIBDIR)
|
||||
$(RANLIB) $(LIBDIR)/libcups.a
|
||||
|
||||
installhdrs:
|
||||
$(INSTALL_DIR) -m 755 $(INCLUDEDIR)/cups
|
||||
@@ -272,7 +271,7 @@ libcups.2.dylib: $(LIBOBJS)
|
||||
# libcups_s.a
|
||||
#
|
||||
|
||||
libcups_s.a: $(LIBOBJS)
|
||||
libcups_s.a: $(LIBOBJS) libcups_s.exp
|
||||
echo Creating $@...
|
||||
$(DSO) $(DSOFLAGS) -Wl,-bexport:libcups_s.exp -o libcups_s.o $(LIBOBJS) $(SSLLIBS) $(COMMONLIBS) $(LIBZ) -lm
|
||||
$(RM) $@
|
||||
@@ -423,7 +422,7 @@ apihelp:
|
||||
file.h file.c dir.h dir.c >../doc/help/api-filedir.html
|
||||
mxmldoc --section "Programming" --title "PPD API" \
|
||||
--intro api-ppd.shtml \
|
||||
ppd.h attr.c emit.c mark.c page.c \
|
||||
ppd.h attr.c custom.c emit.c localize.c mark.c page.c \
|
||||
ppd.c >../doc/help/api-ppd.html
|
||||
mxmldoc --section "Programming" --title "HTTP and IPP APIs" \
|
||||
--intro api-httpipp.shtml \
|
||||
|
||||
@@ -939,11 +939,14 @@ cups_array_find(cups_array_t *a, /* I - Array */
|
||||
|
||||
DEBUG_puts("cups_array_find: linear search");
|
||||
|
||||
diff = 0;
|
||||
diff = 1;
|
||||
|
||||
for (current = 0; current < a->num_elements; current ++)
|
||||
if (a->elements[current] == e)
|
||||
{
|
||||
diff = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -92,9 +92,13 @@ cupsDoAuthentication(http_t *http, /* I - HTTP connection to server */
|
||||
* See if we can do local authentication...
|
||||
*/
|
||||
|
||||
if (!cups_local_auth(http))
|
||||
if (http->digest_tries < 3 && !cups_local_auth(http))
|
||||
{
|
||||
DEBUG_printf(("cupsDoAuthentication: authstring=\"%s\"\n", http->authstring));
|
||||
|
||||
if (http->status == HTTP_UNAUTHORIZED)
|
||||
http->digest_tries ++;
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
@@ -34,6 +34,10 @@
|
||||
*
|
||||
* Contents:
|
||||
*
|
||||
* ppdFindCustomOption() - Find a custom option.
|
||||
* ppdFindCustomParam() - Find a parameter for a custom option.
|
||||
* ppdFirstCustomParam() - Return the first parameter for a custom option.
|
||||
* ppdNextCustomParam() - Return the next parameter for a custom option.
|
||||
*/
|
||||
|
||||
/*
|
||||
@@ -46,6 +50,8 @@
|
||||
|
||||
/*
|
||||
* 'ppdFindCustomOption()' - Find a custom option.
|
||||
*
|
||||
* @since CUPS 1.2@
|
||||
*/
|
||||
|
||||
ppd_coption_t * /* O - Custom option or NULL */
|
||||
@@ -65,6 +71,8 @@ ppdFindCustomOption(ppd_file_t *ppd, /* I - PPD file */
|
||||
|
||||
/*
|
||||
* 'ppdFindCustomParam()' - Find a parameter for a custom option.
|
||||
*
|
||||
* @since CUPS 1.2@
|
||||
*/
|
||||
|
||||
ppd_cparam_t * /* O - Custom parameter or NULL */
|
||||
@@ -84,6 +92,8 @@ ppdFindCustomParam(ppd_coption_t *opt, /* I - Custom option */
|
||||
|
||||
/*
|
||||
* 'ppdFirstCustomParam()' - Return the first parameter for a custom option.
|
||||
*
|
||||
* @since CUPS 1.2@
|
||||
*/
|
||||
|
||||
ppd_cparam_t * /* O - Custom parameter or NULL */
|
||||
@@ -98,6 +108,8 @@ ppdFirstCustomParam(ppd_coption_t *opt) /* I - Custom option */
|
||||
|
||||
/*
|
||||
* 'ppdNextCustomParam()' - Return the next parameter for a custom option.
|
||||
*
|
||||
* @since CUPS 1.2@
|
||||
*/
|
||||
|
||||
ppd_cparam_t * /* O - Custom parameter or NULL */
|
||||
|
||||
@@ -531,6 +531,16 @@ cupsSetDests2(http_t *http, /* I - HTTP connection */
|
||||
return (-1);
|
||||
}
|
||||
|
||||
#ifndef WIN32
|
||||
/*
|
||||
* Set the permissions to 0644 when saving to the /etc/cups/lpoptions
|
||||
* file...
|
||||
*/
|
||||
|
||||
if (!getuid())
|
||||
fchmod(fileno(fp), 0644);
|
||||
#endif /* !WIN32 */
|
||||
|
||||
/*
|
||||
* Write each printer; each line looks like:
|
||||
*
|
||||
|
||||
@@ -364,7 +364,7 @@ cupsEncodeOptions2(
|
||||
* Copy the name over...
|
||||
*/
|
||||
|
||||
if ((attr->name = strdup(option->name)) == NULL)
|
||||
if ((attr->name = _cupsStrAlloc(option->name)) == NULL)
|
||||
{
|
||||
/*
|
||||
* Ran out of memory!
|
||||
@@ -515,14 +515,14 @@ cupsEncodeOptions2(
|
||||
*/
|
||||
|
||||
attr->values[j].unknown.length = strlen(val);
|
||||
attr->values[j].unknown.data = strdup(val);
|
||||
attr->values[j].unknown.data = _cupsStrAlloc(val);
|
||||
|
||||
DEBUG_printf(("cupsEncodeOptions2: Added octet-string value \"%s\"...\n",
|
||||
attr->values[j].unknown.data));
|
||||
break;
|
||||
|
||||
default :
|
||||
if ((attr->values[j].string.text = strdup(val)) == NULL)
|
||||
if ((attr->values[j].string.text = _cupsStrAlloc(val)) == NULL)
|
||||
{
|
||||
/*
|
||||
* Ran out of memory!
|
||||
@@ -537,6 +537,9 @@ cupsEncodeOptions2(
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (copy)
|
||||
free(copy);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,275 @@
|
||||
/*
|
||||
* "$Id$"
|
||||
*
|
||||
* Network interface functions for the Common UNIX Printing System
|
||||
* (CUPS) scheduler.
|
||||
*
|
||||
* Copyright 1997-2006 by Easy Software Products, all rights reserved.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
* property of Easy Software Products and are protected by Federal
|
||||
* copyright law. Distribution and use rights are outlined in the file
|
||||
* "LICENSE" which should have been included with this file. If this
|
||||
* file is missing or damaged please contact Easy Software Products
|
||||
* at:
|
||||
*
|
||||
* Attn: CUPS Licensing Information
|
||||
* Easy Software Products
|
||||
* 44141 Airport View Drive, Suite 204
|
||||
* Hollywood, Maryland 20636 USA
|
||||
*
|
||||
* Voice: (301) 373-9600
|
||||
* EMail: cups-info@cups.org
|
||||
* WWW: http://www.cups.org
|
||||
*
|
||||
* Contents:
|
||||
*
|
||||
* _cups_getifaddrs() - Get a list of network interfaces on the system.
|
||||
* _cups_freeifaddrs() - Free an interface list...
|
||||
*/
|
||||
|
||||
/*
|
||||
* Include necessary headers.
|
||||
*/
|
||||
|
||||
#include "http-private.h"
|
||||
|
||||
|
||||
#ifndef HAVE_GETIFADDRS
|
||||
/*
|
||||
* '_cups_getifaddrs()' - Get a list of network interfaces on the system.
|
||||
*/
|
||||
|
||||
int /* O - 0 on success, -1 on error */
|
||||
_cups_getifaddrs(struct ifaddrs **addrs)/* O - List of interfaces */
|
||||
{
|
||||
int sock; /* Socket */
|
||||
char buffer[65536], /* Buffer for address info */
|
||||
*bufptr, /* Pointer into buffer */
|
||||
*bufend; /* End of buffer */
|
||||
struct ifconf conf; /* Interface configurations */
|
||||
struct sockaddr addr; /* Address data */
|
||||
struct ifreq *ifp; /* Interface data */
|
||||
int ifpsize; /* Size of interface data */
|
||||
struct ifaddrs *temp; /* Pointer to current interface */
|
||||
struct ifreq request; /* Interface request */
|
||||
|
||||
|
||||
/*
|
||||
* Start with an empty list...
|
||||
*/
|
||||
|
||||
if (addrs == NULL)
|
||||
return (-1);
|
||||
|
||||
*addrs = NULL;
|
||||
|
||||
/*
|
||||
* Create a UDP socket to get the interface data...
|
||||
*/
|
||||
|
||||
memset (&addr, 0, sizeof(addr));
|
||||
if ((sock = socket(AF_INET, SOCK_DGRAM, 0)) < 0)
|
||||
return (-1);
|
||||
|
||||
/*
|
||||
* Try to get the list of interfaces...
|
||||
*/
|
||||
|
||||
conf.ifc_len = sizeof(buffer);
|
||||
conf.ifc_buf = buffer;
|
||||
|
||||
if (ioctl(sock, SIOCGIFCONF, &conf) < 0)
|
||||
{
|
||||
/*
|
||||
* Couldn't get the list of interfaces...
|
||||
*/
|
||||
|
||||
close(sock);
|
||||
return (-1);
|
||||
}
|
||||
|
||||
/*
|
||||
* OK, got the list of interfaces, now lets step through the
|
||||
* buffer to pull them out...
|
||||
*/
|
||||
|
||||
# ifdef HAVE_STRUCT_SOCKADDR_SA_LEN
|
||||
# define sockaddr_len(a) ((a)->sa_len)
|
||||
# else
|
||||
# define sockaddr_len(a) (sizeof(struct sockaddr))
|
||||
# endif /* HAVE_STRUCT_SOCKADDR_SA_LEN */
|
||||
|
||||
for (bufptr = buffer, bufend = buffer + conf.ifc_len;
|
||||
bufptr < bufend;
|
||||
bufptr += ifpsize)
|
||||
{
|
||||
/*
|
||||
* Get the current interface information...
|
||||
*/
|
||||
|
||||
ifp = (struct ifreq *)bufptr;
|
||||
ifpsize = sizeof(ifp->ifr_name) + sockaddr_len(&(ifp->ifr_addr));
|
||||
|
||||
if (ifpsize < sizeof(struct ifreq))
|
||||
ifpsize = sizeof(struct ifreq);
|
||||
|
||||
memset(&request, 0, sizeof(request));
|
||||
memcpy(request.ifr_name, ifp->ifr_name, sizeof(ifp->ifr_name));
|
||||
|
||||
/*
|
||||
* Check the status of the interface...
|
||||
*/
|
||||
|
||||
if (ioctl(sock, SIOCGIFFLAGS, &request) < 0)
|
||||
continue;
|
||||
|
||||
/*
|
||||
* Allocate memory for a single interface record...
|
||||
*/
|
||||
|
||||
if ((temp = calloc(1, sizeof(struct ifaddrs))) == NULL)
|
||||
{
|
||||
/*
|
||||
* Unable to allocate memory...
|
||||
*/
|
||||
|
||||
close(sock);
|
||||
return (-1);
|
||||
}
|
||||
|
||||
/*
|
||||
* Add this record to the front of the list and copy the name, flags,
|
||||
* and network address...
|
||||
*/
|
||||
|
||||
temp->ifa_next = *addrs;
|
||||
*addrs = temp;
|
||||
temp->ifa_name = strdup(ifp->ifr_name);
|
||||
temp->ifa_flags = request.ifr_flags;
|
||||
if ((temp->ifa_addr = calloc(1, sockaddr_len(&(ifp->ifr_addr)))) != NULL)
|
||||
memcpy(temp->ifa_addr, &(ifp->ifr_addr), sockaddr_len(&(ifp->ifr_addr)));
|
||||
|
||||
/*
|
||||
* Try to get the netmask for the interface...
|
||||
*/
|
||||
|
||||
if (!ioctl(sock, SIOCGIFNETMASK, &request))
|
||||
{
|
||||
/*
|
||||
* Got it, make a copy...
|
||||
*/
|
||||
|
||||
if ((temp->ifa_netmask = calloc(1, sizeof(request.ifr_netmask))) != NULL)
|
||||
memcpy(temp->ifa_netmask, &(request.ifr_netmask),
|
||||
sizeof(request.ifr_netmask));
|
||||
}
|
||||
|
||||
/*
|
||||
* Then get the broadcast or point-to-point (destination) address,
|
||||
* if applicable...
|
||||
*/
|
||||
|
||||
if (temp->ifa_flags & IFF_BROADCAST)
|
||||
{
|
||||
/*
|
||||
* Have a broadcast address, so get it!
|
||||
*/
|
||||
|
||||
if (!ioctl(sock, SIOCGIFBRDADDR, &request))
|
||||
{
|
||||
/*
|
||||
* Got it, make a copy...
|
||||
*/
|
||||
|
||||
if ((temp->ifa_dstaddr = calloc(1, sizeof(request.ifr_broadaddr))) != NULL)
|
||||
memcpy(temp->ifa_dstaddr, &(request.ifr_broadaddr),
|
||||
sizeof(request.ifr_broadaddr));
|
||||
}
|
||||
}
|
||||
else if (temp->ifa_flags & IFF_POINTOPOINT)
|
||||
{
|
||||
/*
|
||||
* Point-to-point interface; grab the remote address...
|
||||
*/
|
||||
|
||||
if (!ioctl(sock, SIOCGIFDSTADDR, &request))
|
||||
{
|
||||
temp->ifa_dstaddr = malloc(sizeof(request.ifr_dstaddr));
|
||||
memcpy(temp->ifa_dstaddr, &(request.ifr_dstaddr),
|
||||
sizeof(request.ifr_dstaddr));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* OK, we're done with the socket, close it and return 0...
|
||||
*/
|
||||
|
||||
close(sock);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* '_cups_freeifaddrs()' - Free an interface list...
|
||||
*/
|
||||
|
||||
void
|
||||
_cups_freeifaddrs(struct ifaddrs *addrs)/* I - Interface list to free */
|
||||
{
|
||||
struct ifaddrs *next; /* Next interface in list */
|
||||
|
||||
|
||||
while (addrs != NULL)
|
||||
{
|
||||
/*
|
||||
* Make a copy of the next interface pointer...
|
||||
*/
|
||||
|
||||
next = addrs->ifa_next;
|
||||
|
||||
/*
|
||||
* Free data values as needed...
|
||||
*/
|
||||
|
||||
if (addrs->ifa_name)
|
||||
{
|
||||
free(addrs->ifa_name);
|
||||
addrs->ifa_name = NULL;
|
||||
}
|
||||
|
||||
if (addrs->ifa_addr)
|
||||
{
|
||||
free(addrs->ifa_addr);
|
||||
addrs->ifa_addr = NULL;
|
||||
}
|
||||
|
||||
if (addrs->ifa_netmask)
|
||||
{
|
||||
free(addrs->ifa_netmask);
|
||||
addrs->ifa_netmask = NULL;
|
||||
}
|
||||
|
||||
if (addrs->ifa_dstaddr)
|
||||
{
|
||||
free(addrs->ifa_dstaddr);
|
||||
addrs->ifa_dstaddr = NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* Free this node and continue to the next...
|
||||
*/
|
||||
|
||||
free(addrs);
|
||||
|
||||
addrs = next;
|
||||
}
|
||||
}
|
||||
#endif /* !HAVE_GETIFADDRS */
|
||||
|
||||
|
||||
/*
|
||||
* End of "$Id$".
|
||||
*/
|
||||
@@ -37,6 +37,7 @@
|
||||
|
||||
#include "http-private.h"
|
||||
#include "globals.h"
|
||||
#include "debug.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
|
||||
@@ -101,6 +102,8 @@ _cupsGlobals(void)
|
||||
* Initialize the global data exactly once...
|
||||
*/
|
||||
|
||||
DEBUG_printf(("_cupsGlobals(): globals_key_once=%d\n", globals_key_once));
|
||||
|
||||
pthread_once(&globals_key_once, globals_init);
|
||||
|
||||
/*
|
||||
@@ -109,6 +112,8 @@ _cupsGlobals(void)
|
||||
|
||||
if ((globals = (_cups_globals_t *)pthread_getspecific(globals_key)) == NULL)
|
||||
{
|
||||
DEBUG_puts("_cupsGlobals: allocating memory for thread...");
|
||||
|
||||
/*
|
||||
* No, allocate memory as set the pointer for the key...
|
||||
*/
|
||||
@@ -116,6 +121,8 @@ _cupsGlobals(void)
|
||||
globals = calloc(1, sizeof(_cups_globals_t));
|
||||
pthread_setspecific(globals_key, globals);
|
||||
|
||||
DEBUG_printf((" globals=%p\n", globals));
|
||||
|
||||
/*
|
||||
* Initialize variables that have non-zero values
|
||||
*/
|
||||
@@ -142,6 +149,9 @@ static void
|
||||
globals_init()
|
||||
{
|
||||
pthread_key_create(&globals_key, globals_destructor);
|
||||
|
||||
DEBUG_printf(("globals_init(): globals_key=%x(%u)\n", globals_key,
|
||||
globals_key));
|
||||
}
|
||||
|
||||
|
||||
@@ -156,6 +166,8 @@ globals_destructor(void *value) /* I - Data to free */
|
||||
_cups_globals_t *cg; /* Global data */
|
||||
|
||||
|
||||
DEBUG_printf(("globals_destructor(value=%p)\n", value));
|
||||
|
||||
cg = (_cups_globals_t *)value;
|
||||
|
||||
httpClose(cg->http);
|
||||
@@ -163,9 +175,8 @@ globals_destructor(void *value) /* I - Data to free */
|
||||
for (i = 0; i < 3; i ++)
|
||||
cupsFileClose(cg->stdio_files[i]);
|
||||
|
||||
_cupsStrFlush(cg);
|
||||
_cupsLangFlush(cg);
|
||||
_cupsCharmapFlush(cg);
|
||||
if (cg->last_status_message)
|
||||
free(cg->last_status_message);
|
||||
|
||||
cupsFreeOptions(cg->cupsd_num_settings, cg->cupsd_settings);
|
||||
|
||||
|
||||
@@ -95,7 +95,6 @@ typedef struct _cups_globals_s /**** CUPS global state data ****/
|
||||
/* Unknown error statuses */
|
||||
|
||||
/* language.c */
|
||||
cups_lang_t *lang_cache; /* Language string cache */
|
||||
cups_lang_t *lang_default; /* Default language */
|
||||
# ifdef __APPLE__
|
||||
# ifdef HAVE_CF_LOCALE_ID
|
||||
@@ -113,10 +112,6 @@ typedef struct _cups_globals_s /**** CUPS global state data ****/
|
||||
/* tempfile.c */
|
||||
char tempfile[1024]; /* cupsTempFd/File buffer */
|
||||
|
||||
/* transcode.c */
|
||||
_cups_cmap_t *cmap_cache; /* SBCS Charmap Cache */
|
||||
_cups_vmap_t *vmap_cache; /* VBCS Charmap Cache */
|
||||
|
||||
/* usersys.c */
|
||||
http_encryption_t encryption; /* Encryption setting */
|
||||
char user[65], /* User name */
|
||||
@@ -134,9 +129,6 @@ typedef struct _cups_globals_s /**** CUPS global state data ****/
|
||||
/* Default printer */
|
||||
char ppd_filename[HTTP_MAX_URI];
|
||||
/* PPD filename */
|
||||
|
||||
/* string.c */
|
||||
cups_array_t *stringpool; /* String pool */
|
||||
} _cups_globals_t;
|
||||
|
||||
|
||||
@@ -144,12 +136,9 @@ typedef struct _cups_globals_s /**** CUPS global state data ****/
|
||||
* Prototypes...
|
||||
*/
|
||||
|
||||
extern void _cupsCharmapFlush(_cups_globals_t *cg);
|
||||
extern const char *_cupsGetPassword(const char *prompt);
|
||||
extern _cups_globals_t *_cupsGlobals(void);
|
||||
extern void _cupsLangFlush(_cups_globals_t *cg);
|
||||
extern void _cupsSetError(ipp_status_t status, const char *message);
|
||||
extern void _cupsStrFlush(_cups_globals_t *cg);
|
||||
|
||||
|
||||
/*
|
||||
|
||||
@@ -52,6 +52,9 @@
|
||||
int /* O - 1 if "any", 0 otherwise */
|
||||
httpAddrAny(const http_addr_t *addr) /* I - Address to check */
|
||||
{
|
||||
if (!addr)
|
||||
return (0);
|
||||
|
||||
#ifdef AF_INET6
|
||||
if (addr->addr.sa_family == AF_INET6 &&
|
||||
IN6_IS_ADDR_UNSPECIFIED(&(addr->ipv6.sin6_addr)))
|
||||
@@ -76,6 +79,12 @@ int /* O - 1 if equal, 0 if not */
|
||||
httpAddrEqual(const http_addr_t *addr1, /* I - First address */
|
||||
const http_addr_t *addr2) /* I - Second address */
|
||||
{
|
||||
if (!addr1 && !addr2)
|
||||
return (1);
|
||||
|
||||
if (!addr1 || !addr2)
|
||||
return (0);
|
||||
|
||||
if (addr1->addr.sa_family != addr2->addr.sa_family)
|
||||
return (0);
|
||||
|
||||
@@ -102,6 +111,9 @@ httpAddrEqual(const http_addr_t *addr1, /* I - First address */
|
||||
int /* O - Length in bytes */
|
||||
httpAddrLength(const http_addr_t *addr) /* I - Address */
|
||||
{
|
||||
if (!addr)
|
||||
return (0);
|
||||
|
||||
#ifdef AF_INET6
|
||||
if (addr->addr.sa_family == AF_INET6)
|
||||
return (sizeof(addr->ipv6));
|
||||
@@ -131,6 +143,9 @@ int /* O - 1 if local host, 0 otherwise */
|
||||
httpAddrLocalhost(
|
||||
const http_addr_t *addr) /* I - Address to check */
|
||||
{
|
||||
if (!addr)
|
||||
return (1);
|
||||
|
||||
#ifdef AF_INET6
|
||||
if (addr->addr.sa_family == AF_INET6 &&
|
||||
IN6_IS_ADDR_LOOPBACK(&(addr->ipv6.sin6_addr)))
|
||||
@@ -508,6 +523,9 @@ httpGetHostname(http_t *http, /* I - HTTP connection or NULL */
|
||||
struct hostent *host; /* Host entry to get FQDN */
|
||||
|
||||
|
||||
if (!s || slen <= 1)
|
||||
return (NULL);
|
||||
|
||||
if (http)
|
||||
{
|
||||
if (http->hostname[0] == '/')
|
||||
@@ -521,7 +539,8 @@ httpGetHostname(http_t *http, /* I - HTTP connection or NULL */
|
||||
* Get the hostname...
|
||||
*/
|
||||
|
||||
gethostname(s, slen);
|
||||
if (gethostname(s, slen) < 0)
|
||||
strlcpy(s, "localhost", slen);
|
||||
|
||||
if (!strchr(s, '.'))
|
||||
{
|
||||
@@ -529,7 +548,7 @@ httpGetHostname(http_t *http, /* I - HTTP connection or NULL */
|
||||
* The hostname is not a FQDN, so look it up...
|
||||
*/
|
||||
|
||||
if ((host = gethostbyname(s)) != NULL)
|
||||
if ((host = gethostbyname(s)) != NULL && host->h_name)
|
||||
strlcpy(s, host->h_name, slen);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -411,7 +411,7 @@ httpAddrGetList(const char *hostname, /* I - Hostname, IP address, or NULL for p
|
||||
# ifdef AF_INET6
|
||||
if (host->h_addrtype == AF_INET6)
|
||||
{
|
||||
first->addr.ipv6.sin6_family = AF_INET6;
|
||||
temp->addr.ipv6.sin6_family = AF_INET6;
|
||||
memcpy(&(temp->addr.ipv6), host->h_addr_list[i],
|
||||
sizeof(temp->addr.ipv6));
|
||||
temp->addr.ipv6.sin6_port = htons(portnum);
|
||||
@@ -419,7 +419,7 @@ httpAddrGetList(const char *hostname, /* I - Hostname, IP address, or NULL for p
|
||||
else
|
||||
# endif /* AF_INET6 */
|
||||
{
|
||||
first->addr.ipv4.sin_family = AF_INET;
|
||||
temp->addr.ipv4.sin_family = AF_INET;
|
||||
memcpy(&(temp->addr.ipv4), host->h_addr_list[i],
|
||||
sizeof(temp->addr.ipv4));
|
||||
temp->addr.ipv4.sin_port = htons(portnum);
|
||||
|
||||
@@ -31,7 +31,8 @@
|
||||
* Include necessary headers...
|
||||
*/
|
||||
|
||||
# include "config.h"
|
||||
# include <stdlib.h>
|
||||
# include <config.h>
|
||||
|
||||
# ifdef __sun
|
||||
/*
|
||||
@@ -98,7 +99,20 @@ typedef struct
|
||||
|
||||
# include <Security/SecureTransport.h>
|
||||
|
||||
typedef SSLConnectionRef http_tls_t;
|
||||
typedef struct /**** CDSA connection information ****/
|
||||
{
|
||||
SSLContextRef session; /* CDSA session object */
|
||||
CFArrayRef certsArray; /* Certificates array */
|
||||
} http_tls_t;
|
||||
|
||||
typedef union _cdsa_conn_ref_u /**** CDSA Connection reference union
|
||||
**** used to resolve 64-bit casting
|
||||
**** warnings.
|
||||
****/
|
||||
{
|
||||
SSLConnectionRef connection; /* SSL connection pointer */
|
||||
int sock; /* Socket */
|
||||
} cdsa_conn_ref_t;
|
||||
|
||||
extern OSStatus _httpReadCDSA(SSLConnectionRef connection, void *data,
|
||||
size_t *dataLength);
|
||||
@@ -120,6 +134,44 @@ extern const char *_cups_hstrerror(int error);
|
||||
extern const char *hstrerror(int error);
|
||||
# endif /* !HAVE_HSTRERROR */
|
||||
|
||||
|
||||
/*
|
||||
* Some OS's don't have getifaddrs() and freeifaddrs()...
|
||||
*/
|
||||
|
||||
# include <net/if.h>
|
||||
# ifdef HAVE_GETIFADDRS
|
||||
# include <ifaddrs.h>
|
||||
# else
|
||||
# include <sys/ioctl.h>
|
||||
# ifdef HAVE_SYS_SOCKIO_H
|
||||
# include <sys/sockio.h>
|
||||
# endif /* HAVE_SYS_SOCKIO_H */
|
||||
|
||||
# ifdef ifa_dstaddr
|
||||
# undef ifa_dstaddr
|
||||
# endif /* ifa_dstaddr */
|
||||
# ifndef ifr_netmask
|
||||
# define ifr_netmask ifr_addr
|
||||
# endif /* !ifr_netmask */
|
||||
|
||||
struct ifaddrs /**** Interface Structure ****/
|
||||
{
|
||||
struct ifaddrs *ifa_next; /* Next interface in list */
|
||||
char *ifa_name; /* Name of interface */
|
||||
unsigned int ifa_flags; /* Flags (up, point-to-point, etc.) */
|
||||
struct sockaddr *ifa_addr, /* Network address */
|
||||
*ifa_netmask, /* Address mask */
|
||||
*ifa_dstaddr; /* Broadcast or destination address */
|
||||
void *ifa_data; /* Interface statistics */
|
||||
};
|
||||
|
||||
extern int _cups_getifaddrs(struct ifaddrs **addrs);
|
||||
# define getifaddrs _cups_getifaddrs
|
||||
extern void _cups_freeifaddrs(struct ifaddrs *addrs);
|
||||
# define freeifaddrs _cups_freeifaddrs
|
||||
# endif /* HAVE_GETIFADDRS */
|
||||
|
||||
#endif /* !_CUPS_HTTP_PRIVATE_H_ */
|
||||
|
||||
/*
|
||||
|
||||
@@ -1057,7 +1057,7 @@ httpSeparateURI(
|
||||
|
||||
*port = strtol(uri + 1, (char **)&uri, 10);
|
||||
|
||||
if (*uri != '/')
|
||||
if (*uri != '/' && *uri)
|
||||
{
|
||||
*port = 0;
|
||||
return (HTTP_URI_BAD_PORT);
|
||||
@@ -1141,6 +1141,10 @@ httpStatus(http_status_t status) /* I - HTTP status code */
|
||||
return ("Accepted");
|
||||
case HTTP_NO_CONTENT :
|
||||
return ("No Content");
|
||||
case HTTP_MOVED_PERMANENTLY :
|
||||
return ("Moved Permanently");
|
||||
case HTTP_SEE_OTHER :
|
||||
return ("See Other");
|
||||
case HTTP_NOT_MODIFIED :
|
||||
return ("Not Modified");
|
||||
case HTTP_BAD_REQUEST :
|
||||
|
||||
@@ -867,7 +867,11 @@ httpGets(char *line, /* I - Line to read into */
|
||||
*/
|
||||
|
||||
if (!http->blocking && !http_wait(http, 1000))
|
||||
{
|
||||
DEBUG_puts("httpGets: Timed out!");
|
||||
http->error = ETIMEDOUT;
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
#ifdef HAVE_SSL
|
||||
if (http->tls)
|
||||
@@ -1388,11 +1392,15 @@ _httpReadCDSA(
|
||||
void *data, /* I - Data buffer */
|
||||
size_t *dataLength) /* IO - Number of bytes */
|
||||
{
|
||||
OSStatus result; /* Return value */
|
||||
ssize_t bytes; /* Number of bytes read */
|
||||
OSStatus result; /* Return value */
|
||||
ssize_t bytes; /* Number of bytes read */
|
||||
cdsa_conn_ref_t u; /* Connection reference union */
|
||||
|
||||
|
||||
u.connection = connection;
|
||||
|
||||
do
|
||||
bytes = recv((int)connection, data, *dataLength, 0);
|
||||
bytes = recv(u.sock, data, *dataLength, 0);
|
||||
while (bytes == -1 && errno == EINTR);
|
||||
|
||||
if (bytes == *dataLength)
|
||||
@@ -1962,11 +1970,15 @@ _httpWriteCDSA(
|
||||
const void *data, /* I - Data buffer */
|
||||
size_t *dataLength) /* IO - Number of bytes */
|
||||
{
|
||||
OSStatus result; /* Return value */
|
||||
ssize_t bytes; /* Number of bytes read */
|
||||
OSStatus result; /* Return value */
|
||||
ssize_t bytes; /* Number of bytes read */
|
||||
cdsa_conn_ref_t u; /* Connection reference union */
|
||||
|
||||
|
||||
u.connection = connection;
|
||||
|
||||
do
|
||||
bytes = write((int)connection, data, *dataLength);
|
||||
bytes = write(u.sock, data, *dataLength);
|
||||
while (bytes == -1 && errno == EINTR);
|
||||
|
||||
if (bytes == *dataLength)
|
||||
@@ -2033,7 +2045,7 @@ http_read_ssl(http_t *http, /* I - HTTP connection */
|
||||
size_t processed; /* Number of bytes processed */
|
||||
|
||||
|
||||
error = SSLRead((SSLContextRef)http->tls, buf, len, &processed);
|
||||
error = SSLRead(((http_tls_t *)http->tls)->session, buf, len, &processed);
|
||||
|
||||
switch (error)
|
||||
{
|
||||
@@ -2209,15 +2221,16 @@ static int /* O - Status of connection */
|
||||
http_setup_ssl(http_t *http) /* I - HTTP connection */
|
||||
{
|
||||
# ifdef HAVE_LIBSSL
|
||||
SSL_CTX *context; /* Context for encryption */
|
||||
SSL *conn; /* Connection for encryption */
|
||||
SSL_CTX *context; /* Context for encryption */
|
||||
SSL *conn; /* Connection for encryption */
|
||||
# elif defined(HAVE_GNUTLS)
|
||||
http_tls_t *conn; /* TLS session object */
|
||||
http_tls_t *conn; /* TLS session object */
|
||||
gnutls_certificate_client_credentials *credentials;
|
||||
/* TLS credentials */
|
||||
/* TLS credentials */
|
||||
# elif defined(HAVE_CDSASSL)
|
||||
SSLContextRef conn; /* Context for encryption */
|
||||
OSStatus error; /* Error info */
|
||||
OSStatus error; /* Error code */
|
||||
http_tls_t *conn; /* CDSA connection information */
|
||||
cdsa_conn_ref_t u; /* Connection reference union */
|
||||
# endif /* HAVE_LIBSSL */
|
||||
|
||||
|
||||
@@ -2254,9 +2267,7 @@ http_setup_ssl(http_t *http) /* I - HTTP connection */
|
||||
}
|
||||
|
||||
# elif defined(HAVE_GNUTLS)
|
||||
conn = (http_tls_t *)malloc(sizeof(http_tls_t));
|
||||
|
||||
if (conn == NULL)
|
||||
if ((conn = (http_tls_t *)malloc(sizeof(http_tls_t))) == NULL)
|
||||
{
|
||||
http->error = errno;
|
||||
http->status = HTTP_ERROR;
|
||||
@@ -2295,34 +2306,51 @@ http_setup_ssl(http_t *http) /* I - HTTP connection */
|
||||
conn->credentials = credentials;
|
||||
|
||||
# elif defined(HAVE_CDSASSL)
|
||||
error = SSLNewContext(false, &conn);
|
||||
conn = (http_tls_t *)calloc(1, sizeof(http_tls_t));
|
||||
|
||||
if (!error)
|
||||
error = SSLSetIOFuncs(conn, _httpReadCDSA, _httpWriteCDSA);
|
||||
if (conn == NULL)
|
||||
return (-1);
|
||||
|
||||
if (!error)
|
||||
error = SSLSetConnection(conn, (SSLConnectionRef)http->fd);
|
||||
|
||||
if (!error)
|
||||
error = SSLSetAllowsExpiredCerts(conn, true);
|
||||
|
||||
if (!error)
|
||||
error = SSLSetAllowsAnyRoot(conn, true);
|
||||
|
||||
if (!error)
|
||||
{
|
||||
while ((error = SSLHandshake(conn)) == errSSLWouldBlock)
|
||||
usleep(1000);
|
||||
}
|
||||
|
||||
if (error != 0)
|
||||
if ((error = SSLNewContext(false, &conn->session)))
|
||||
{
|
||||
http->error = error;
|
||||
http->status = HTTP_ERROR;
|
||||
|
||||
SSLDisposeContext(conn);
|
||||
free(conn);
|
||||
return (-1);
|
||||
}
|
||||
|
||||
close(http->fd);
|
||||
/*
|
||||
* Use a union to resolve warnings about int/pointer size mismatches...
|
||||
*/
|
||||
|
||||
u.connection = NULL;
|
||||
u.sock = http->fd;
|
||||
error = SSLSetConnection(conn->session, u.connection);
|
||||
|
||||
if (!error)
|
||||
error = SSLSetIOFuncs(conn->session, _httpReadCDSA, _httpWriteCDSA);
|
||||
|
||||
if (!error)
|
||||
error = SSLSetAllowsExpiredCerts(conn->session, true);
|
||||
|
||||
if (!error)
|
||||
error = SSLSetAllowsAnyRoot(conn->session, true);
|
||||
|
||||
if (!error)
|
||||
{
|
||||
while ((error = SSLHandshake(conn->session)) == errSSLWouldBlock)
|
||||
usleep(1000);
|
||||
}
|
||||
|
||||
if (error)
|
||||
{
|
||||
http->error = error;
|
||||
http->status = HTTP_ERROR;
|
||||
|
||||
SSLDisposeContext(conn->session);
|
||||
|
||||
free(conn);
|
||||
|
||||
return (-1);
|
||||
}
|
||||
@@ -2340,11 +2368,11 @@ http_setup_ssl(http_t *http) /* I - HTTP connection */
|
||||
*/
|
||||
|
||||
static void
|
||||
http_shutdown_ssl(http_t *http) /* I - HTTP connection */
|
||||
http_shutdown_ssl(http_t *http) /* I - HTTP connection */
|
||||
{
|
||||
# ifdef HAVE_LIBSSL
|
||||
SSL_CTX *context; /* Context for encryption */
|
||||
SSL *conn; /* Connection for encryption */
|
||||
SSL_CTX *context; /* Context for encryption */
|
||||
SSL *conn; /* Connection for encryption */
|
||||
|
||||
|
||||
conn = (SSL *)(http->tls);
|
||||
@@ -2355,9 +2383,9 @@ http_shutdown_ssl(http_t *http) /* I - HTTP connection */
|
||||
SSL_free(conn);
|
||||
|
||||
# elif defined(HAVE_GNUTLS)
|
||||
http_tls_t *conn; /* Encryption session */
|
||||
http_tls_t *conn; /* Encryption session */
|
||||
gnutls_certificate_client_credentials *credentials;
|
||||
/* TLS credentials */
|
||||
/* TLS credentials */
|
||||
|
||||
|
||||
conn = (http_tls_t *)(http->tls);
|
||||
@@ -2370,10 +2398,20 @@ http_shutdown_ssl(http_t *http) /* I - HTTP connection */
|
||||
free(conn);
|
||||
|
||||
# elif defined(HAVE_CDSASSL)
|
||||
while (SSLClose((SSLContextRef)http->tls) == errSSLWouldBlock)
|
||||
http_tls_t *conn; /* CDSA connection information */
|
||||
|
||||
|
||||
conn = (http_tls_t *)(http->tls);
|
||||
|
||||
while (SSLClose(conn->session) == errSSLWouldBlock)
|
||||
usleep(1000);
|
||||
|
||||
SSLDisposeContext((SSLContextRef)http->tls);
|
||||
SSLDisposeContext(conn->session);
|
||||
|
||||
if (conn->certsArray)
|
||||
CFRelease(conn->certsArray);
|
||||
|
||||
free(conn);
|
||||
# endif /* HAVE_LIBSSL */
|
||||
|
||||
http->tls = NULL;
|
||||
@@ -2386,11 +2424,11 @@ http_shutdown_ssl(http_t *http) /* I - HTTP connection */
|
||||
* 'http_upgrade()' - Force upgrade to TLS encryption.
|
||||
*/
|
||||
|
||||
static int /* O - Status of connection */
|
||||
http_upgrade(http_t *http) /* I - HTTP connection */
|
||||
static int /* O - Status of connection */
|
||||
http_upgrade(http_t *http) /* I - HTTP connection */
|
||||
{
|
||||
int ret; /* Return value */
|
||||
http_t myhttp; /* Local copy of HTTP data */
|
||||
int ret; /* Return value */
|
||||
http_t myhttp; /* Local copy of HTTP data */
|
||||
|
||||
|
||||
DEBUG_printf(("http_upgrade(%p)\n", http));
|
||||
@@ -2510,7 +2548,7 @@ http_wait(http_t *http, /* I - HTTP connection */
|
||||
# elif defined(HAVE_CDSASSL)
|
||||
size_t bytes; /* Bytes that are available */
|
||||
|
||||
if (!SSLGetBufferedReadSize((SSLContextRef)http->tls, &bytes) && bytes > 0)
|
||||
if (!SSLGetBufferedReadSize(((http_tls_t *)http->tls)->session, &bytes) && bytes > 0)
|
||||
return (1);
|
||||
# endif /* HAVE_LIBSSL */
|
||||
}
|
||||
@@ -2553,6 +2591,8 @@ http_wait(http_t *http, /* I - HTTP connection */
|
||||
{
|
||||
FD_SET(http->fd, http->input_set);
|
||||
|
||||
DEBUG_printf(("http_wait: msec=%d, http->fd=%d\n", msec, http->fd));
|
||||
|
||||
if (msec >= 0)
|
||||
{
|
||||
timeout.tv_sec = msec / 1000;
|
||||
@@ -2562,6 +2602,8 @@ http_wait(http_t *http, /* I - HTTP connection */
|
||||
}
|
||||
else
|
||||
nfds = select(http->fd + 1, http->input_set, NULL, NULL, NULL);
|
||||
|
||||
DEBUG_printf(("http_wait: select() returned %d...\n", nfds));
|
||||
}
|
||||
#ifdef WIN32
|
||||
while (nfds < 0 && WSAGetLastError() == WSAEINTR);
|
||||
@@ -2571,6 +2613,8 @@ http_wait(http_t *http, /* I - HTTP connection */
|
||||
|
||||
FD_CLR(http->fd, http->input_set);
|
||||
|
||||
DEBUG_printf(("http_wait: returning with nfds=%d...\n", nfds));
|
||||
|
||||
return (nfds > 0);
|
||||
}
|
||||
|
||||
@@ -2726,7 +2770,7 @@ http_write_ssl(http_t *http, /* I - HTTP connection */
|
||||
size_t processed; /* Number of bytes processed */
|
||||
|
||||
|
||||
error = SSLWrite((SSLContextRef)http->tls, buf, len, &processed);
|
||||
error = SSLWrite(((http_tls_t *)http->tls)->session, buf, len, &processed);
|
||||
|
||||
switch (error)
|
||||
{
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
* Include necessary headers...
|
||||
*/
|
||||
|
||||
# include <stdio.h>
|
||||
# include "transcode.h"
|
||||
|
||||
# ifdef __cplusplus
|
||||
@@ -90,6 +91,7 @@ typedef struct _cups_vmap_s /**** VBCS Charmap Struct ****/
|
||||
* Prototypes...
|
||||
*/
|
||||
|
||||
extern void _cupsCharmapFlush(void);
|
||||
extern void _cupsCharmapFree(const cups_encoding_t encoding);
|
||||
extern void *_cupsCharmapGet(const cups_encoding_t encoding);
|
||||
extern const char *_cupsEncodingName(cups_encoding_t encoding);
|
||||
|
||||
@@ -1034,6 +1034,7 @@ ippReadIO(void *src, /* I - Data source */
|
||||
|
||||
DEBUG_printf(("ippReadIO(%p, %p, %d, %p, %p)\n", src, cb, blocking,
|
||||
parent, ipp));
|
||||
DEBUG_printf(("ippReadIO: ipp->state=%d\n", ipp->state));
|
||||
|
||||
if (src == NULL || ipp == NULL)
|
||||
return (IPP_ERROR);
|
||||
@@ -1527,6 +1528,8 @@ ippReadIO(void *src, /* I - Data source */
|
||||
break; /* anti-compiler-warning-code */
|
||||
}
|
||||
|
||||
DEBUG_printf(("ippReadIO: returning ipp->state=%d!\n", ipp->state));
|
||||
|
||||
return (ipp->state);
|
||||
}
|
||||
|
||||
@@ -1672,7 +1675,7 @@ ippWriteIO(void *dst, /* I - Destination */
|
||||
|
||||
if ((*cb)(dst, buffer, (int)(bufptr - buffer)) < 0)
|
||||
{
|
||||
DEBUG_puts("ippWrite: Could not write IPP header...");
|
||||
DEBUG_puts("ippWriteIO: Could not write IPP header...");
|
||||
return (IPP_ERROR);
|
||||
}
|
||||
}
|
||||
@@ -1686,9 +1689,9 @@ ippWriteIO(void *dst, /* I - Destination */
|
||||
ipp->current = ipp->attrs;
|
||||
ipp->curtag = IPP_TAG_ZERO;
|
||||
|
||||
DEBUG_printf(("ippWrite: version=%d.%d\n", buffer[0], buffer[1]));
|
||||
DEBUG_printf(("ippWrite: op_status=%04x\n", ipp->request.any.op_status));
|
||||
DEBUG_printf(("ippWrite: request_id=%d\n", ipp->request.any.request_id));
|
||||
DEBUG_printf(("ippWriteIO: version=%d.%d\n", buffer[0], buffer[1]));
|
||||
DEBUG_printf(("ippWriteIO: op_status=%04x\n", ipp->request.any.op_status));
|
||||
DEBUG_printf(("ippWriteIO: request_id=%d\n", ipp->request.any.request_id));
|
||||
|
||||
/*
|
||||
* If blocking is disabled, stop here...
|
||||
@@ -1720,7 +1723,7 @@ ippWriteIO(void *dst, /* I - Destination */
|
||||
if (attr->group_tag == IPP_TAG_ZERO)
|
||||
continue;
|
||||
|
||||
DEBUG_printf(("ippWrite: wrote group tag = %x\n", attr->group_tag));
|
||||
DEBUG_printf(("ippWriteIO: wrote group tag = %x\n", attr->group_tag));
|
||||
*bufptr++ = attr->group_tag;
|
||||
}
|
||||
else if (attr->group_tag == IPP_TAG_ZERO)
|
||||
@@ -1751,8 +1754,8 @@ ippWriteIO(void *dst, /* I - Destination */
|
||||
* Write the value tag, name length, and name string...
|
||||
*/
|
||||
|
||||
DEBUG_printf(("ippWrite: writing value tag = %x\n", attr->value_tag));
|
||||
DEBUG_printf(("ippWrite: writing name = %d, \'%s\'\n", n, attr->name));
|
||||
DEBUG_printf(("ippWriteIO: writing value tag = %x\n", attr->value_tag));
|
||||
DEBUG_printf(("ippWriteIO: writing name = %d, \'%s\'\n", n, attr->name));
|
||||
|
||||
*bufptr++ = attr->value_tag;
|
||||
*bufptr++ = n >> 8;
|
||||
@@ -1775,11 +1778,11 @@ ippWriteIO(void *dst, /* I - Destination */
|
||||
* and empty name for the collection member attribute...
|
||||
*/
|
||||
|
||||
DEBUG_printf(("ippWrite: writing value tag = %x\n",
|
||||
DEBUG_printf(("ippWriteIO: writing value tag = %x\n",
|
||||
IPP_TAG_MEMBERNAME));
|
||||
DEBUG_printf(("ippWrite: writing name = %d, \'%s\'\n", n, attr->name));
|
||||
DEBUG_printf(("ippWrite: writing value tag = %x\n", attr->value_tag));
|
||||
DEBUG_puts("ippWrite: writing name = 0, \'\'\n");
|
||||
DEBUG_printf(("ippWriteIO: writing name = %d, \'%s\'\n", n, attr->name));
|
||||
DEBUG_printf(("ippWriteIO: writing value tag = %x\n", attr->value_tag));
|
||||
DEBUG_puts("ippWriteIO: writing name = 0, \'\'\n");
|
||||
|
||||
*bufptr++ = IPP_TAG_MEMBERNAME;
|
||||
*bufptr++ = 0;
|
||||
@@ -1810,7 +1813,7 @@ ippWriteIO(void *dst, /* I - Destination */
|
||||
{
|
||||
if ((*cb)(dst, buffer, (int)(bufptr - buffer)) < 0)
|
||||
{
|
||||
DEBUG_puts("ippWrite: Could not write IPP attribute...");
|
||||
DEBUG_puts("ippWriteIO: Could not write IPP attribute...");
|
||||
return (IPP_ERROR);
|
||||
}
|
||||
|
||||
@@ -1854,7 +1857,7 @@ ippWriteIO(void *dst, /* I - Destination */
|
||||
{
|
||||
if ((*cb)(dst, buffer, (int)(bufptr - buffer)) < 0)
|
||||
{
|
||||
DEBUG_puts("ippWrite: Could not write IPP attribute...");
|
||||
DEBUG_puts("ippWriteIO: Could not write IPP attribute...");
|
||||
return (IPP_ERROR);
|
||||
}
|
||||
|
||||
@@ -1905,15 +1908,15 @@ ippWriteIO(void *dst, /* I - Destination */
|
||||
* values with a zero-length name...
|
||||
*/
|
||||
|
||||
DEBUG_printf(("ippWrite: writing value tag = %x\n",
|
||||
DEBUG_printf(("ippWriteIO: writing value tag = %x\n",
|
||||
attr->value_tag));
|
||||
DEBUG_printf(("ippWrite: writing name = 0, \'\'\n"));
|
||||
DEBUG_printf(("ippWriteIO: writing name = 0, \'\'\n"));
|
||||
|
||||
if ((sizeof(buffer) - (bufptr - buffer)) < 3)
|
||||
{
|
||||
if ((*cb)(dst, buffer, (int)(bufptr - buffer)) < 0)
|
||||
{
|
||||
DEBUG_puts("ippWrite: Could not write IPP attribute...");
|
||||
DEBUG_puts("ippWriteIO: Could not write IPP attribute...");
|
||||
return (IPP_ERROR);
|
||||
}
|
||||
|
||||
@@ -1933,14 +1936,14 @@ ippWriteIO(void *dst, /* I - Destination */
|
||||
if (n > (sizeof(buffer) - 2))
|
||||
return (IPP_ERROR);
|
||||
|
||||
DEBUG_printf(("ippWrite: writing string = %d, \'%s\'\n", n,
|
||||
DEBUG_printf(("ippWriteIO: writing string = %d, \'%s\'\n", n,
|
||||
value->string.text));
|
||||
|
||||
if ((int)(sizeof(buffer) - (bufptr - buffer)) < (n + 2))
|
||||
{
|
||||
if ((*cb)(dst, buffer, (int)(bufptr - buffer)) < 0)
|
||||
{
|
||||
DEBUG_puts("ippWrite: Could not write IPP attribute...");
|
||||
DEBUG_puts("ippWriteIO: Could not write IPP attribute...");
|
||||
return (IPP_ERROR);
|
||||
}
|
||||
|
||||
@@ -1977,7 +1980,7 @@ ippWriteIO(void *dst, /* I - Destination */
|
||||
{
|
||||
if ((*cb)(dst, buffer, (int)(bufptr - buffer)) < 0)
|
||||
{
|
||||
DEBUG_puts("ippWrite: Could not write IPP attribute...");
|
||||
DEBUG_puts("ippWriteIO: Could not write IPP attribute...");
|
||||
return (IPP_ERROR);
|
||||
}
|
||||
|
||||
@@ -2020,7 +2023,7 @@ ippWriteIO(void *dst, /* I - Destination */
|
||||
{
|
||||
if ((*cb)(dst, buffer, (int)(bufptr - buffer)) < 0)
|
||||
{
|
||||
DEBUG_puts("ippWrite: Could not write IPP attribute...");
|
||||
DEBUG_puts("ippWriteIO: Could not write IPP attribute...");
|
||||
return (IPP_ERROR);
|
||||
}
|
||||
|
||||
@@ -2071,7 +2074,7 @@ ippWriteIO(void *dst, /* I - Destination */
|
||||
{
|
||||
if ((*cb)(dst, buffer, (int)(bufptr - buffer)) < 0)
|
||||
{
|
||||
DEBUG_puts("ippWrite: Could not write IPP attribute...");
|
||||
DEBUG_puts("ippWriteIO: Could not write IPP attribute...");
|
||||
return (IPP_ERROR);
|
||||
}
|
||||
|
||||
@@ -2128,7 +2131,7 @@ ippWriteIO(void *dst, /* I - Destination */
|
||||
{
|
||||
if ((*cb)(dst, buffer, (int)(bufptr - buffer)) < 0)
|
||||
{
|
||||
DEBUG_puts("ippWrite: Could not write IPP attribute...");
|
||||
DEBUG_puts("ippWriteIO: Could not write IPP attribute...");
|
||||
return (IPP_ERROR);
|
||||
}
|
||||
|
||||
@@ -2165,7 +2168,7 @@ ippWriteIO(void *dst, /* I - Destination */
|
||||
{
|
||||
if ((*cb)(dst, buffer, (int)(bufptr - buffer)) < 0)
|
||||
{
|
||||
DEBUG_puts("ippWrite: Could not write IPP attribute...");
|
||||
DEBUG_puts("ippWriteIO: Could not write IPP attribute...");
|
||||
return (IPP_ERROR);
|
||||
}
|
||||
|
||||
@@ -2226,7 +2229,7 @@ ippWriteIO(void *dst, /* I - Destination */
|
||||
{
|
||||
if ((*cb)(dst, buffer, (int)(bufptr - buffer)) < 0)
|
||||
{
|
||||
DEBUG_puts("ippWrite: Could not write IPP attribute...");
|
||||
DEBUG_puts("ippWriteIO: Could not write IPP attribute...");
|
||||
return (IPP_ERROR);
|
||||
}
|
||||
|
||||
@@ -2254,7 +2257,7 @@ ippWriteIO(void *dst, /* I - Destination */
|
||||
|
||||
if ((*cb)(dst, buffer, (int)(bufptr - buffer)) < 0)
|
||||
{
|
||||
DEBUG_puts("ippWrite: Could not write IPP attribute...");
|
||||
DEBUG_puts("ippWriteIO: Could not write IPP attribute...");
|
||||
return (IPP_ERROR);
|
||||
}
|
||||
|
||||
@@ -2287,7 +2290,7 @@ ippWriteIO(void *dst, /* I - Destination */
|
||||
{
|
||||
if ((*cb)(dst, buffer, (int)(bufptr - buffer)) < 0)
|
||||
{
|
||||
DEBUG_puts("ippWrite: Could not write IPP attribute...");
|
||||
DEBUG_puts("ippWriteIO: Could not write IPP attribute...");
|
||||
return (IPP_ERROR);
|
||||
}
|
||||
|
||||
@@ -2315,7 +2318,7 @@ ippWriteIO(void *dst, /* I - Destination */
|
||||
{
|
||||
if ((*cb)(dst, buffer, (int)(bufptr - buffer)) < 0)
|
||||
{
|
||||
DEBUG_puts("ippWrite: Could not write IPP attribute...");
|
||||
DEBUG_puts("ippWriteIO: Could not write IPP attribute...");
|
||||
return (IPP_ERROR);
|
||||
}
|
||||
|
||||
@@ -2342,11 +2345,11 @@ ippWriteIO(void *dst, /* I - Destination */
|
||||
|
||||
if ((*cb)(dst, buffer, (int)(bufptr - buffer)) < 0)
|
||||
{
|
||||
DEBUG_puts("ippWrite: Could not write IPP attribute...");
|
||||
DEBUG_puts("ippWriteIO: Could not write IPP attribute...");
|
||||
return (IPP_ERROR);
|
||||
}
|
||||
|
||||
DEBUG_printf(("ippWrite: wrote %d bytes\n", bufptr - buffer));
|
||||
DEBUG_printf(("ippWriteIO: wrote %d bytes\n", bufptr - buffer));
|
||||
|
||||
/*
|
||||
* If blocking is disabled, stop here...
|
||||
@@ -2380,7 +2383,7 @@ ippWriteIO(void *dst, /* I - Destination */
|
||||
|
||||
if ((*cb)(dst, buffer, n) < 0)
|
||||
{
|
||||
DEBUG_puts("ippWrite: Could not write IPP end-tag...");
|
||||
DEBUG_puts("ippWriteIO: Could not write IPP end-tag...");
|
||||
return (IPP_ERROR);
|
||||
}
|
||||
|
||||
@@ -2806,14 +2809,14 @@ ipp_write_file(int *fd, /* I - File descriptor */
|
||||
*/
|
||||
|
||||
ipp_attribute_t * /* O - New attribute */
|
||||
_ipp_add(ipp_t *ipp, /* I - IPP message */
|
||||
int num_values) /* I - Number of values */
|
||||
_ipp_add_attr(ipp_t *ipp, /* I - IPP message */
|
||||
int num_values) /* I - Number of values */
|
||||
{
|
||||
return (_ippAddAttr(ipp, num_values));
|
||||
}
|
||||
|
||||
void
|
||||
_ipp_free(ipp_attribute_t *attr) /* I - Attribute to free */
|
||||
_ipp_free_attr(ipp_attribute_t *attr) /* I - Attribute to free */
|
||||
{
|
||||
_ippFreeAttr(attr);
|
||||
}
|
||||
|
||||
@@ -31,7 +31,6 @@
|
||||
* cupsLangEncoding() - Return the character encoding (us-ascii, etc.)
|
||||
* for the given language.
|
||||
* cupsLangFlush() - Flush all language data out of the cache.
|
||||
* _cupsLangFlush() - Flush all language data out of the cache.
|
||||
* cupsLangFree() - Free language data.
|
||||
* cupsLangGet() - Get a language.
|
||||
* _cupsLangString() - Get a message string.
|
||||
@@ -65,6 +64,18 @@
|
||||
#endif /* HAVE_COREFOUNDATION_H */
|
||||
|
||||
|
||||
/*
|
||||
* Local globals...
|
||||
*/
|
||||
|
||||
#ifdef HAVE_PTHREAD_H
|
||||
static pthread_mutex_t lang_mutex = PTHREAD_MUTEX_INITIALIZER;
|
||||
/* Mutex to control access to cache */
|
||||
#endif /* HAVE_PTHREAD_H */
|
||||
static cups_lang_t *lang_cache = NULL;
|
||||
/* Language string cache */
|
||||
|
||||
|
||||
/*
|
||||
* Local functions...
|
||||
*/
|
||||
@@ -203,17 +214,6 @@ cupsLangEncoding(cups_lang_t *lang) /* I - Language data */
|
||||
|
||||
void
|
||||
cupsLangFlush(void)
|
||||
{
|
||||
_cupsLangFlush(_cupsGlobals());
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* '_cupsLangFlush()' - Flush all language data out of the cache.
|
||||
*/
|
||||
|
||||
void
|
||||
_cupsLangFlush(_cups_globals_t *cg) /* I - Global data */
|
||||
{
|
||||
cups_lang_t *lang, /* Current language */
|
||||
*next; /* Next language */
|
||||
@@ -223,7 +223,11 @@ _cupsLangFlush(_cups_globals_t *cg) /* I - Global data */
|
||||
* Free all languages in the cache...
|
||||
*/
|
||||
|
||||
for (lang = cg->lang_cache; lang != NULL; lang = next)
|
||||
#ifdef HAVE_PTHREAD_H
|
||||
pthread_mutex_lock(&lang_mutex);
|
||||
#endif /* HAVE_PTHREAD_H */
|
||||
|
||||
for (lang = lang_cache; lang != NULL; lang = next)
|
||||
{
|
||||
/*
|
||||
* Free all messages...
|
||||
@@ -239,7 +243,11 @@ _cupsLangFlush(_cups_globals_t *cg) /* I - Global data */
|
||||
free(lang);
|
||||
}
|
||||
|
||||
cg->lang_cache = NULL;
|
||||
lang_cache = NULL;
|
||||
|
||||
#ifdef HAVE_PTHREAD_H
|
||||
pthread_mutex_unlock(&lang_mutex);
|
||||
#endif /* HAVE_PTHREAD_H */
|
||||
}
|
||||
|
||||
|
||||
@@ -252,8 +260,16 @@ _cupsLangFlush(_cups_globals_t *cg) /* I - Global data */
|
||||
void
|
||||
cupsLangFree(cups_lang_t *lang) /* I - Language to free */
|
||||
{
|
||||
#ifdef HAVE_PTHREAD_H
|
||||
pthread_mutex_lock(&lang_mutex);
|
||||
#endif /* HAVE_PTHREAD_H */
|
||||
|
||||
if (lang != NULL && lang->used > 0)
|
||||
lang->used --;
|
||||
|
||||
#ifdef HAVE_PTHREAD_H
|
||||
pthread_mutex_unlock(&lang_mutex);
|
||||
#endif /* HAVE_PTHREAD_H */
|
||||
}
|
||||
|
||||
|
||||
@@ -558,14 +574,27 @@ cupsLangGet(const char *language) /* I - Language or locale */
|
||||
{
|
||||
snprintf(real, sizeof(real), "%s_%s", langname, country);
|
||||
|
||||
if ((lang = cups_cache_lookup(real, encoding)) != NULL)
|
||||
return (lang);
|
||||
|
||||
snprintf(filename, sizeof(filename), "%s/%s/cups_%s.po", cg->localedir,
|
||||
real, real);
|
||||
}
|
||||
else
|
||||
{
|
||||
strcpy(real, langname);
|
||||
filename[0] = '\0'; /* anti-compiler-warning-code */
|
||||
}
|
||||
|
||||
#ifdef HAVE_PTHREAD_H
|
||||
pthread_mutex_lock(&lang_mutex);
|
||||
#endif /* HAVE_PTHREAD_H */
|
||||
|
||||
if ((lang = cups_cache_lookup(langname, encoding)) != NULL)
|
||||
{
|
||||
#ifdef HAVE_PTHREAD_H
|
||||
pthread_mutex_unlock(&lang_mutex);
|
||||
#endif /* HAVE_PTHREAD_H */
|
||||
|
||||
return (lang);
|
||||
}
|
||||
|
||||
if (!country[0] || access(filename, 0))
|
||||
{
|
||||
@@ -573,9 +602,6 @@ cupsLangGet(const char *language) /* I - Language or locale */
|
||||
* Country localization not available, look for generic localization...
|
||||
*/
|
||||
|
||||
if ((lang = cups_cache_lookup(langname, encoding)) != NULL)
|
||||
return (lang);
|
||||
|
||||
snprintf(filename, sizeof(filename), "%s/%s/cups_%s.po", cg->localedir,
|
||||
langname, langname);
|
||||
|
||||
@@ -587,11 +613,8 @@ cupsLangGet(const char *language) /* I - Language or locale */
|
||||
|
||||
DEBUG_printf(("access(\"%s\", 0): %s\n", filename, strerror(errno)));
|
||||
|
||||
strcpy(real, "C");
|
||||
snprintf(filename, sizeof(filename), "%s/C/cups_C.po", cg->localedir);
|
||||
}
|
||||
else
|
||||
strcpy(real, langname);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -599,7 +622,7 @@ cupsLangGet(const char *language) /* I - Language or locale */
|
||||
* record...
|
||||
*/
|
||||
|
||||
for (lang = cg->lang_cache; lang != NULL; lang = lang->next)
|
||||
for (lang = lang_cache; lang != NULL; lang = lang->next)
|
||||
if (lang->used == 0)
|
||||
break;
|
||||
|
||||
@@ -610,10 +633,16 @@ cupsLangGet(const char *language) /* I - Language or locale */
|
||||
*/
|
||||
|
||||
if ((lang = calloc(sizeof(cups_lang_t), 1)) == NULL)
|
||||
return (NULL);
|
||||
{
|
||||
#ifdef HAVE_PTHREAD_H
|
||||
pthread_mutex_unlock(&lang_mutex);
|
||||
#endif /* HAVE_PTHREAD_H */
|
||||
|
||||
lang->next = cg->lang_cache;
|
||||
cg->lang_cache = lang;
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
lang->next = lang_cache;
|
||||
lang_cache = lang;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -646,6 +675,10 @@ cupsLangGet(const char *language) /* I - Language or locale */
|
||||
* Return...
|
||||
*/
|
||||
|
||||
#ifdef HAVE_PTHREAD_H
|
||||
pthread_mutex_unlock(&lang_mutex);
|
||||
#endif /* HAVE_PTHREAD_H */
|
||||
|
||||
return (lang);
|
||||
}
|
||||
|
||||
@@ -668,7 +701,21 @@ _cupsLangString(cups_lang_t *lang, /* I - Language */
|
||||
if (!lang || !message)
|
||||
return (message);
|
||||
|
||||
#ifdef HAVE_PTHREAD_H
|
||||
{
|
||||
const char *s; /* Localized message */
|
||||
|
||||
pthread_mutex_lock(&lang_mutex);
|
||||
|
||||
s = _cupsMessageLookup(lang->strings, message);
|
||||
|
||||
pthread_mutex_unlock(&lang_mutex);
|
||||
|
||||
return (s);
|
||||
}
|
||||
#else
|
||||
return (_cupsMessageLookup(lang->strings, message));
|
||||
#endif /* HAVE_PTHREAD_H */
|
||||
}
|
||||
|
||||
|
||||
@@ -1166,7 +1213,7 @@ cups_cache_lookup(const char *name,/* I - Name of locale */
|
||||
* Loop through the cache and return a match if found...
|
||||
*/
|
||||
|
||||
for (lang = _cupsGlobals()->lang_cache; lang != NULL; lang = lang->next)
|
||||
for (lang = lang_cache; lang != NULL; lang = lang->next)
|
||||
{
|
||||
DEBUG_printf(("cups_cache_lookup: lang=%p, language=\"%s\", encoding=%d(%s)\n",
|
||||
lang, lang->language, lang->encoding,
|
||||
|
||||
@@ -6,7 +6,6 @@ _cupsCharmapGet
|
||||
_cupsEncodingName
|
||||
_cupsGetPassword
|
||||
_cupsGlobals
|
||||
_cupsLangFlush
|
||||
_cupsLangPrintf
|
||||
_cupsLangPuts
|
||||
_cupsLangString
|
||||
@@ -23,6 +22,8 @@ _cupsStrFormatd
|
||||
_cupsStrFree
|
||||
_cupsStrScand
|
||||
_cupsStrStatistics
|
||||
_cups_getifaddrs
|
||||
_cups_freeifaddrs
|
||||
_cups_strcpy
|
||||
_cups_strlcat
|
||||
_cups_strlcpy
|
||||
|
||||
@@ -56,6 +56,8 @@ static const char *ppd_text(ppd_file_t *ppd, const char *keyword,
|
||||
|
||||
/*
|
||||
* 'ppdLocalize()' - Localize the PPD file to the current locale.
|
||||
*
|
||||
* @since CUPS 1.2@
|
||||
*/
|
||||
|
||||
int /* O - 0 on success, -1 on error */
|
||||
|
||||
@@ -64,11 +64,12 @@ cupsDoFileRequest(http_t *http, /* I - HTTP connection to server */
|
||||
ipp_t *response; /* IPP response data */
|
||||
size_t length; /* Content-Length value */
|
||||
http_status_t status; /* Status of HTTP request */
|
||||
int got_status; /* Did we get the status? */
|
||||
ipp_state_t state; /* State of IPP processing */
|
||||
FILE *file; /* File to send */
|
||||
struct stat fileinfo; /* File information */
|
||||
int bytes; /* Number of bytes read/written */
|
||||
char buffer[65536]; /* Output buffer */
|
||||
char buffer[32768]; /* Output buffer */
|
||||
|
||||
|
||||
DEBUG_printf(("cupsDoFileRequest(%p, %p, \'%s\', \'%s\')\n",
|
||||
@@ -117,7 +118,7 @@ cupsDoFileRequest(http_t *http, /* I - HTTP connection to server */
|
||||
|
||||
ippDelete(request);
|
||||
|
||||
_cupsSetError(IPP_NOT_POSSIBLE, NULL);
|
||||
_cupsSetError(IPP_NOT_POSSIBLE, strerror(EISDIR));
|
||||
|
||||
return (NULL);
|
||||
}
|
||||
@@ -184,54 +185,58 @@ cupsDoFileRequest(http_t *http, /* I - HTTP connection to server */
|
||||
}
|
||||
|
||||
/*
|
||||
* Wait up to 1 second for a 100-continue response...
|
||||
* Send the IPP data...
|
||||
*/
|
||||
|
||||
if (httpWait(http, 1000))
|
||||
status = httpUpdate(http);
|
||||
else
|
||||
status = HTTP_CONTINUE;
|
||||
DEBUG_puts("cupsDoFileRequest: ipp write...");
|
||||
|
||||
if (status == HTTP_CONTINUE)
|
||||
request->state = IPP_IDLE;
|
||||
status = HTTP_CONTINUE;
|
||||
got_status = 0;
|
||||
|
||||
while ((state = ippWrite(http, request)) != IPP_DATA)
|
||||
if (state == IPP_ERROR)
|
||||
break;
|
||||
else if (httpCheck(http))
|
||||
{
|
||||
got_status = 1;
|
||||
|
||||
if ((status = httpUpdate(http)) != HTTP_CONTINUE)
|
||||
break;
|
||||
}
|
||||
|
||||
if (!got_status)
|
||||
{
|
||||
/*
|
||||
* Send the IPP data...
|
||||
* Wait up to 1 second to get the 100-continue response...
|
||||
*/
|
||||
|
||||
DEBUG_puts("cupsDoFileRequest: ipp write...");
|
||||
if (httpWait(http, 1000))
|
||||
status = httpUpdate(http);
|
||||
}
|
||||
else if (httpCheck(http))
|
||||
status = httpUpdate(http);
|
||||
|
||||
request->state = IPP_IDLE;
|
||||
if (status == HTTP_CONTINUE && state == IPP_DATA && filename)
|
||||
{
|
||||
DEBUG_puts("cupsDoFileRequest: file write...");
|
||||
|
||||
while ((state = ippWrite(http, request)) != IPP_DATA)
|
||||
if (state == IPP_ERROR)
|
||||
break;
|
||||
else if (httpCheck(http))
|
||||
/*
|
||||
* Send the file...
|
||||
*/
|
||||
|
||||
rewind(file);
|
||||
|
||||
while ((bytes = (int)fread(buffer, 1, sizeof(buffer), file)) > 0)
|
||||
{
|
||||
if (httpCheck(http))
|
||||
{
|
||||
if ((status = httpUpdate(http)) != HTTP_CONTINUE)
|
||||
break;
|
||||
}
|
||||
|
||||
if (state == IPP_DATA && filename)
|
||||
{
|
||||
DEBUG_puts("cupsDoFileRequest: file write...");
|
||||
|
||||
/*
|
||||
* Send the file...
|
||||
*/
|
||||
|
||||
rewind(file);
|
||||
|
||||
while ((bytes = (int)fread(buffer, 1, sizeof(buffer), file)) > 0)
|
||||
{
|
||||
if (httpCheck(http))
|
||||
{
|
||||
if ((status = httpUpdate(http)) != HTTP_CONTINUE)
|
||||
break;
|
||||
}
|
||||
|
||||
if (httpWrite2(http, buffer, bytes) < bytes)
|
||||
break;
|
||||
}
|
||||
if (httpWrite2(http, buffer, bytes) < bytes)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -273,10 +278,15 @@ cupsDoFileRequest(http_t *http, /* I - HTTP connection to server */
|
||||
}
|
||||
else if (status == HTTP_ERROR)
|
||||
{
|
||||
DEBUG_printf(("cupsDoFileRequest: http->error=%d (%s)\n", http->error,
|
||||
strerror(http->error)));
|
||||
|
||||
#ifdef WIN32
|
||||
if (http->error != WSAENETDOWN && http->error != WSAENETUNREACH)
|
||||
if (http->error != WSAENETDOWN && http->error != WSAENETUNREACH &&
|
||||
http->error != ETIMEDOUT)
|
||||
#else
|
||||
if (http->error != ENETDOWN && http->error != ENETUNREACH)
|
||||
if (http->error != ENETDOWN && http->error != ENETUNREACH &&
|
||||
http->error != ETIMEDOUT)
|
||||
#endif /* WIN32 */
|
||||
continue;
|
||||
else
|
||||
@@ -323,20 +333,21 @@ cupsDoFileRequest(http_t *http, /* I - HTTP connection to server */
|
||||
|
||||
response = ippNew();
|
||||
|
||||
if (ippRead(http, response) == IPP_ERROR)
|
||||
{
|
||||
/*
|
||||
* Delete the response...
|
||||
*/
|
||||
while ((state = ippRead(http, response)) != IPP_DATA)
|
||||
if (state == IPP_ERROR)
|
||||
{
|
||||
/*
|
||||
* Delete the response...
|
||||
*/
|
||||
|
||||
DEBUG_puts("IPP read error!");
|
||||
ippDelete(response);
|
||||
response = NULL;
|
||||
DEBUG_puts("IPP read error!");
|
||||
ippDelete(response);
|
||||
response = NULL;
|
||||
|
||||
_cupsSetError(IPP_SERVICE_UNAVAILABLE, strerror(errno));
|
||||
_cupsSetError(IPP_SERVICE_UNAVAILABLE, strerror(errno));
|
||||
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -46,9 +46,24 @@
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <limits.h>
|
||||
#include "array.h"
|
||||
#include "debug.h"
|
||||
#include "string.h"
|
||||
#include "globals.h"
|
||||
#ifdef HAVE_PTHREAD_H
|
||||
# include <pthread.h>
|
||||
#endif /* HAVE_PTHREAD_H */
|
||||
|
||||
|
||||
/*
|
||||
* Local globals...
|
||||
*/
|
||||
|
||||
#ifdef HAVE_PTHREAD_H
|
||||
static pthread_mutex_t sp_mutex = PTHREAD_MUTEX_INITIALIZER;
|
||||
/* Mutex to control access to pool */
|
||||
#endif /* HAVE_PTHREAD_H */
|
||||
static cups_array_t *stringpool = NULL;
|
||||
/* Global string pool */
|
||||
|
||||
|
||||
/*
|
||||
@@ -65,7 +80,6 @@ static int compare_sp_items(_cups_sp_item_t *a, _cups_sp_item_t *b);
|
||||
char * /* O - String pointer */
|
||||
_cupsStrAlloc(const char *s) /* I - String */
|
||||
{
|
||||
_cups_globals_t *cg; /* Global data */
|
||||
_cups_sp_item_t *item, /* String pool item */
|
||||
key; /* Search key */
|
||||
|
||||
@@ -81,13 +95,21 @@ _cupsStrAlloc(const char *s) /* I - String */
|
||||
* Get the string pool...
|
||||
*/
|
||||
|
||||
cg = _cupsGlobals();
|
||||
#ifdef HAVE_PTHREAD_H
|
||||
pthread_mutex_lock(&sp_mutex);
|
||||
#endif /* HAVE_PTHREAD_H */
|
||||
|
||||
if (!cg->stringpool)
|
||||
cg->stringpool = cupsArrayNew((cups_array_func_t)compare_sp_items, NULL);
|
||||
if (!stringpool)
|
||||
stringpool = cupsArrayNew((cups_array_func_t)compare_sp_items, NULL);
|
||||
|
||||
if (!stringpool)
|
||||
{
|
||||
#ifdef HAVE_PTHREAD_H
|
||||
pthread_mutex_unlock(&sp_mutex);
|
||||
#endif /* HAVE_PTHREAD_H */
|
||||
|
||||
if (!cg->stringpool)
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
* See if the string is already in the pool...
|
||||
@@ -95,7 +117,7 @@ _cupsStrAlloc(const char *s) /* I - String */
|
||||
|
||||
key.str = (char *)s;
|
||||
|
||||
if ((item = (_cups_sp_item_t *)cupsArrayFind(cg->stringpool, &key)) != NULL)
|
||||
if ((item = (_cups_sp_item_t *)cupsArrayFind(stringpool, &key)) != NULL)
|
||||
{
|
||||
/*
|
||||
* Found it, return the cached string...
|
||||
@@ -103,6 +125,10 @@ _cupsStrAlloc(const char *s) /* I - String */
|
||||
|
||||
item->ref_count ++;
|
||||
|
||||
#ifdef HAVE_PTHREAD_H
|
||||
pthread_mutex_unlock(&sp_mutex);
|
||||
#endif /* HAVE_PTHREAD_H */
|
||||
|
||||
return (item->str);
|
||||
}
|
||||
|
||||
@@ -112,7 +138,13 @@ _cupsStrAlloc(const char *s) /* I - String */
|
||||
|
||||
item = (_cups_sp_item_t *)calloc(1, sizeof(_cups_sp_item_t));
|
||||
if (!item)
|
||||
{
|
||||
#ifdef HAVE_PTHREAD_H
|
||||
pthread_mutex_unlock(&sp_mutex);
|
||||
#endif /* HAVE_PTHREAD_H */
|
||||
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
item->ref_count = 1;
|
||||
item->str = strdup(s);
|
||||
@@ -120,6 +152,11 @@ _cupsStrAlloc(const char *s) /* I - String */
|
||||
if (!item->str)
|
||||
{
|
||||
free(item);
|
||||
|
||||
#ifdef HAVE_PTHREAD_H
|
||||
pthread_mutex_unlock(&sp_mutex);
|
||||
#endif /* HAVE_PTHREAD_H */
|
||||
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
@@ -127,7 +164,11 @@ _cupsStrAlloc(const char *s) /* I - String */
|
||||
* Add the string to the pool and return it...
|
||||
*/
|
||||
|
||||
cupsArrayAdd(cg->stringpool, item);
|
||||
cupsArrayAdd(stringpool, item);
|
||||
|
||||
#ifdef HAVE_PTHREAD_H
|
||||
pthread_mutex_unlock(&sp_mutex);
|
||||
#endif /* HAVE_PTHREAD_H */
|
||||
|
||||
return (item->str);
|
||||
}
|
||||
@@ -138,20 +179,32 @@ _cupsStrAlloc(const char *s) /* I - String */
|
||||
*/
|
||||
|
||||
void
|
||||
_cupsStrFlush(_cups_globals_t *cg) /* I - Global data */
|
||||
_cupsStrFlush(void)
|
||||
{
|
||||
_cups_sp_item_t *item; /* Current item */
|
||||
|
||||
|
||||
for (item = (_cups_sp_item_t *)cupsArrayFirst(cg->stringpool);
|
||||
DEBUG_printf(("_cupsStrFlush(cg=%p)\n", cg));
|
||||
DEBUG_printf((" %d strings in array\n", cupsArrayCount(stringpool)));
|
||||
|
||||
#ifdef HAVE_PTHREAD_H
|
||||
pthread_mutex_lock(&sp_mutex);
|
||||
#endif /* HAVE_PTHREAD_H */
|
||||
|
||||
for (item = (_cups_sp_item_t *)cupsArrayFirst(stringpool);
|
||||
item;
|
||||
item = (_cups_sp_item_t *)cupsArrayNext(cg->stringpool))
|
||||
item = (_cups_sp_item_t *)cupsArrayNext(stringpool))
|
||||
{
|
||||
free(item->str);
|
||||
free(item);
|
||||
}
|
||||
|
||||
cupsArrayDelete(cg->stringpool);
|
||||
cupsArrayDelete(stringpool);
|
||||
stringpool = NULL;
|
||||
|
||||
#ifdef HAVE_PTHREAD_H
|
||||
pthread_mutex_unlock(&sp_mutex);
|
||||
#endif /* HAVE_PTHREAD_H */
|
||||
}
|
||||
|
||||
|
||||
@@ -242,7 +295,6 @@ _cupsStrFormatd(char *buf, /* I - String */
|
||||
void
|
||||
_cupsStrFree(const char *s) /* I - String to free */
|
||||
{
|
||||
_cups_globals_t *cg; /* Global data */
|
||||
_cups_sp_item_t *item, /* String pool item */
|
||||
key; /* Search key */
|
||||
|
||||
@@ -255,21 +307,28 @@ _cupsStrFree(const char *s) /* I - String to free */
|
||||
return;
|
||||
|
||||
/*
|
||||
* Get the string pool...
|
||||
* Check the string pool...
|
||||
*
|
||||
* We don't need to lock the mutex yet, as we only want to know if
|
||||
* the stringpool is initialized. The rest of the code will still
|
||||
* work if it is initialized before we lock...
|
||||
*/
|
||||
|
||||
cg = _cupsGlobals();
|
||||
|
||||
if (!cg->stringpool)
|
||||
if (!stringpool)
|
||||
return;
|
||||
|
||||
/*
|
||||
* See if the string is already in the pool...
|
||||
*/
|
||||
|
||||
#ifdef HAVE_PTHREAD_H
|
||||
pthread_mutex_lock(&sp_mutex);
|
||||
#endif /* HAVE_PTHREAD_H */
|
||||
|
||||
key.str = (char *)s;
|
||||
|
||||
if ((item = (_cups_sp_item_t *)cupsArrayFind(cg->stringpool, &key)) != NULL)
|
||||
if ((item = (_cups_sp_item_t *)cupsArrayFind(stringpool, &key)) != NULL &&
|
||||
item->str == s)
|
||||
{
|
||||
/*
|
||||
* Found it, dereference...
|
||||
@@ -283,12 +342,16 @@ _cupsStrFree(const char *s) /* I - String to free */
|
||||
* Remove and free...
|
||||
*/
|
||||
|
||||
cupsArrayRemove(cg->stringpool, item);
|
||||
cupsArrayRemove(stringpool, item);
|
||||
|
||||
free(item->str);
|
||||
free(item);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef HAVE_PTHREAD_H
|
||||
pthread_mutex_unlock(&sp_mutex);
|
||||
#endif /* HAVE_PTHREAD_H */
|
||||
}
|
||||
|
||||
|
||||
@@ -402,19 +465,20 @@ _cupsStrStatistics(size_t *alloc_bytes, /* O - Allocated bytes */
|
||||
tbytes, /* Total string bytes */
|
||||
len; /* Length of string */
|
||||
_cups_sp_item_t *item; /* Current item */
|
||||
_cups_globals_t *cg; /* Global data */
|
||||
|
||||
|
||||
/*
|
||||
* Loop through strings in pool, counting everything up...
|
||||
*/
|
||||
|
||||
cg = _cupsGlobals();
|
||||
#ifdef HAVE_PTHREAD_H
|
||||
pthread_mutex_lock(&sp_mutex);
|
||||
#endif /* HAVE_PTHREAD_H */
|
||||
|
||||
for (count = 0, abytes = 0, tbytes = 0,
|
||||
item = (_cups_sp_item_t *)cupsArrayFirst(cg->stringpool);
|
||||
item = (_cups_sp_item_t *)cupsArrayFirst(stringpool);
|
||||
item;
|
||||
item = (_cups_sp_item_t *)cupsArrayNext(cg->stringpool))
|
||||
item = (_cups_sp_item_t *)cupsArrayNext(stringpool))
|
||||
{
|
||||
/*
|
||||
* Count allocated memory, using a 64-bit aligned buffer as a basis.
|
||||
@@ -426,6 +490,10 @@ _cupsStrStatistics(size_t *alloc_bytes, /* O - Allocated bytes */
|
||||
tbytes += item->ref_count * len;
|
||||
}
|
||||
|
||||
#ifdef HAVE_PTHREAD_H
|
||||
pthread_mutex_unlock(&sp_mutex);
|
||||
#endif /* HAVE_PTHREAD_H */
|
||||
|
||||
/*
|
||||
* Return values...
|
||||
*/
|
||||
|
||||
@@ -31,13 +31,14 @@
|
||||
* Include necessary headers...
|
||||
*/
|
||||
|
||||
# include <config.h>
|
||||
|
||||
# include <stdio.h>
|
||||
# include <stdlib.h>
|
||||
# include <stdarg.h>
|
||||
# include <ctype.h>
|
||||
# include <locale.h>
|
||||
|
||||
# include <config.h>
|
||||
|
||||
# ifdef HAVE_STRING_H
|
||||
# include <string.h>
|
||||
# endif /* HAVE_STRING_H */
|
||||
@@ -131,6 +132,7 @@ extern int _cups_vsnprintf(char *, size_t, const char *, va_list);
|
||||
*/
|
||||
|
||||
extern char *_cupsStrAlloc(const char *s);
|
||||
extern void _cupsStrFlush(void);
|
||||
extern void _cupsStrFree(const char *s);
|
||||
extern size_t _cupsStrStatistics(size_t *alloc_bytes, size_t *total_bytes);
|
||||
|
||||
|
||||
@@ -126,6 +126,7 @@
|
||||
*OpenUI IntOption/Integer: PickOne
|
||||
*OrderDependency: 10 AnySetup *IntOption
|
||||
*DefaultIntOption: None
|
||||
*IntOption None: ""
|
||||
*IntOption 1: "IntOption=1"
|
||||
*IntOption 2: "IntOption=2"
|
||||
*IntOption 3: "IntOption=3"
|
||||
@@ -137,6 +138,7 @@
|
||||
*OpenUI StringOption/String: PickOne
|
||||
*OrderDependency: 10 AnySetup *StringOption
|
||||
*DefaultStringOption: None
|
||||
*StringOption None: ""
|
||||
*StringOption foo: "StringOption=foo"
|
||||
*StringOption bar: "StringOption=bar"
|
||||
*CloseUI: *StringOption
|
||||
|
||||
@@ -94,6 +94,8 @@ static uri_test_t uri_tests[] = /* URI test data */
|
||||
"mailto", "", "", "user@domain.com", 0, 0 },
|
||||
{ HTTP_URI_OK, "socket://server/",
|
||||
"socket", "", "server", "/", 9100, 0 },
|
||||
{ HTTP_URI_OK, "socket://192.168.1.1:9101/",
|
||||
"socket", "", "192.168.1.1", "/", 9101, 9101 },
|
||||
{ HTTP_URI_OK, "ipp://username:password@[v1.fe80::200:1234:5678:9abc+eth0]:999/ipp",
|
||||
"ipp", "username:password", "fe80::200:1234:5678:9abc%eth0", "/ipp", 999, 999 },
|
||||
{ HTTP_URI_OK, "http://server/admin?DEVICE_URI=usb://HP/Photosmart%25202600%2520series?serial=MY53OK70V10400",
|
||||
@@ -112,6 +114,8 @@ static uri_test_t uri_tests[] = /* URI test data */
|
||||
/* Missing resource */
|
||||
{ HTTP_URI_MISSING_RESOURCE, "socket://[::192.168.2.1]",
|
||||
"socket", "", "::192.168.2.1", "/", 9100, 0 },
|
||||
{ HTTP_URI_MISSING_RESOURCE, "socket://192.168.1.1:9101",
|
||||
"socket", "", "192.168.1.1", "/", 9101 },
|
||||
|
||||
/* Bad URI */
|
||||
{ HTTP_URI_BAD_URI, "",
|
||||
|
||||
@@ -23,9 +23,8 @@
|
||||
*
|
||||
* Contents:
|
||||
*
|
||||
* main() - Main entry for internationalization test module.
|
||||
* print_utf8() - Print UTF-8 string with (optional) message.
|
||||
* print_utf32() - Print UTF-32 string with (optional) message.
|
||||
* main() - Main entry for internationalization test module.
|
||||
* print_utf8() - Print UTF-8 string with (optional) message.
|
||||
*/
|
||||
|
||||
/*
|
||||
@@ -36,6 +35,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "i18n.h"
|
||||
#include "string.h"
|
||||
@@ -46,7 +46,6 @@
|
||||
*/
|
||||
|
||||
static void print_utf8(const char *msg, const cups_utf8_t *src);
|
||||
static void print_utf32(const char *msg, const cups_utf32_t *src);
|
||||
|
||||
|
||||
/*
|
||||
@@ -81,18 +80,21 @@ main(int argc, /* I - Argument Count */
|
||||
cups_utf8_t utf8taiwan[] = /* UTF-8 Chinese source */
|
||||
{ 0x41, 0x20, 0x21, 0x3D, 0x20, 0xE4, 0xB9, 0x82, 0x2E, 0x00 };
|
||||
/* "A != <CJK U+4E42>." - use Windows 950 (Big5) or EUC-TW */
|
||||
cups_utf8_t utf8good[] = /* UTF-8 good 16-bit source */
|
||||
{ 0x41, 0x20, 0xE2, 0x89, 0xA2, 0x20, 0xC3, 0x84, 0x2E, 0x00 };
|
||||
/* "A <NOT IDENTICAL TO> <A WITH DIAERESIS>." */
|
||||
cups_utf8_t utf8bad[] = /* UTF-8 bad 16-bit source */
|
||||
{ 0x41, 0x20, 0xE2, 0x89, 0xA2, 0x20, 0xF8, 0x84, 0x2E, 0x00 };
|
||||
/* "A <NOT IDENTICAL TO> <...bad stuff...>." */
|
||||
cups_utf8_t utf8dest[1024]; /* UTF-8 destination string */
|
||||
cups_utf32_t utf32src[1024]; /* UTF-32 source string */
|
||||
cups_utf32_t utf32dest[1024]; /* UTF-32 destination string */
|
||||
_cups_vmap_t *vmap; /* VBCS charmap pointer */
|
||||
|
||||
|
||||
/*
|
||||
* Make sure we have a symbolic link from the data directory to a
|
||||
* "charmaps" directory, and then point the library at it...
|
||||
*/
|
||||
|
||||
if (access("charmaps", 0))
|
||||
symlink("../data", "charmaps");
|
||||
|
||||
putenv("CUPS_DATADIR=.");
|
||||
|
||||
/*
|
||||
* Start with some conversion tests from a UTF-8 test file.
|
||||
*/
|
||||
@@ -238,7 +240,7 @@ main(int argc, /* I - Argument Count */
|
||||
len = cupsCharsetToUTF8(utf8dest, legsrc, 1024, CUPS_ISO8859_1);
|
||||
if (len != strlen((char *)utf8latin))
|
||||
{
|
||||
printf("FAIL (len=%d, expected %d)\n", len, strlen((char *)utf8latin));
|
||||
printf("FAIL (len=%d, expected %d)\n", len, (int)strlen((char *)utf8latin));
|
||||
print_utf8(" utf8latin", utf8latin);
|
||||
print_utf8(" utf8dest", utf8dest);
|
||||
errors ++;
|
||||
@@ -289,7 +291,7 @@ main(int argc, /* I - Argument Count */
|
||||
len = cupsCharsetToUTF8(utf8dest, legsrc, 1024, CUPS_ISO8859_7);
|
||||
if (len != strlen((char *)utf8greek))
|
||||
{
|
||||
printf("FAIL (len=%d, expected %d)\n", len, strlen((char *)utf8greek));
|
||||
printf("FAIL (len=%d, expected %d)\n", len, (int)strlen((char *)utf8greek));
|
||||
print_utf8(" utf8greek", utf8greek);
|
||||
print_utf8(" utf8dest", utf8dest);
|
||||
errors ++;
|
||||
@@ -335,7 +337,7 @@ main(int argc, /* I - Argument Count */
|
||||
len = cupsCharsetToUTF8(utf8dest, legsrc, 1024, CUPS_WINDOWS_932);
|
||||
if (len != strlen((char *)utf8japan))
|
||||
{
|
||||
printf("FAIL (len=%d, expected %d)\n", len, strlen((char *)utf8japan));
|
||||
printf("FAIL (len=%d, expected %d)\n", len, (int)strlen((char *)utf8japan));
|
||||
print_utf8(" utf8japan", utf8japan);
|
||||
print_utf8(" utf8dest", utf8dest);
|
||||
errors ++;
|
||||
@@ -381,7 +383,7 @@ main(int argc, /* I - Argument Count */
|
||||
len = cupsCharsetToUTF8(utf8dest, legsrc, 1024, CUPS_EUC_JP);
|
||||
if (len != strlen((char *)utf8japan))
|
||||
{
|
||||
printf("FAIL (len=%d, expected %d)\n", len, strlen((char *)utf8japan));
|
||||
printf("FAIL (len=%d, expected %d)\n", len, (int)strlen((char *)utf8japan));
|
||||
print_utf8(" utf8japan", utf8japan);
|
||||
print_utf8(" utf8dest", utf8dest);
|
||||
errors ++;
|
||||
@@ -427,7 +429,7 @@ main(int argc, /* I - Argument Count */
|
||||
len = cupsCharsetToUTF8(utf8dest, legsrc, 1024, CUPS_WINDOWS_950);
|
||||
if (len != strlen((char *)utf8taiwan))
|
||||
{
|
||||
printf("FAIL (len=%d, expected %d)\n", len, strlen((char *)utf8taiwan));
|
||||
printf("FAIL (len=%d, expected %d)\n", len, (int)strlen((char *)utf8taiwan));
|
||||
print_utf8(" utf8taiwan", utf8taiwan);
|
||||
print_utf8(" utf8dest", utf8dest);
|
||||
errors ++;
|
||||
@@ -473,7 +475,7 @@ main(int argc, /* I - Argument Count */
|
||||
len = cupsCharsetToUTF8(utf8dest, legsrc, 1024, CUPS_EUC_TW);
|
||||
if (len != strlen((char *)utf8taiwan))
|
||||
{
|
||||
printf("FAIL (len=%d, expected %d)\n", len, strlen((char *)utf8taiwan));
|
||||
printf("FAIL (len=%d, expected %d)\n", len, (int)strlen((char *)utf8taiwan));
|
||||
print_utf8(" utf8taiwan", utf8taiwan);
|
||||
print_utf8(" utf8dest", utf8dest);
|
||||
errors ++;
|
||||
@@ -553,24 +555,6 @@ print_utf8(const char *msg, /* I - Message String */
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'print_utf32()' - Print UTF-32 string with (optional) message.
|
||||
*/
|
||||
|
||||
static void
|
||||
print_utf32(const char *msg, /* I - Message String */
|
||||
const cups_utf32_t *src) /* I - UTF-32 Source String */
|
||||
{
|
||||
if (msg)
|
||||
printf("%s:", msg);
|
||||
|
||||
for (; *src; src ++)
|
||||
printf(" %04x", (int) *src);
|
||||
|
||||
putchar('\n');
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* End of "$Id$"
|
||||
*/
|
||||
|
||||
@@ -78,50 +78,94 @@ main(int argc, /* I - Number of command-line arguments */
|
||||
|
||||
status = 0;
|
||||
|
||||
fputs("ppdOpenFile: ", stdout);
|
||||
|
||||
if ((ppd = ppdOpenFile("test.ppd")) != NULL)
|
||||
puts("PASS");
|
||||
else
|
||||
if (argc == 1)
|
||||
{
|
||||
ppd_status_t err; /* Last error in file */
|
||||
int line; /* Line number in file */
|
||||
fputs("ppdOpenFile: ", stdout);
|
||||
|
||||
if ((ppd = ppdOpenFile("test.ppd")) != NULL)
|
||||
puts("PASS");
|
||||
else
|
||||
{
|
||||
ppd_status_t err; /* Last error in file */
|
||||
int line; /* Line number in file */
|
||||
|
||||
|
||||
status ++;
|
||||
err = ppdLastError(&line);
|
||||
status ++;
|
||||
err = ppdLastError(&line);
|
||||
|
||||
printf("FAIL (%s on line %d)\n", ppdErrorString(err), line);
|
||||
}
|
||||
printf("FAIL (%s on line %d)\n", ppdErrorString(err), line);
|
||||
}
|
||||
|
||||
fputs("ppdMarkDefaults: ", stdout);
|
||||
ppdMarkDefaults(ppd);
|
||||
fputs("ppdMarkDefaults: ", stdout);
|
||||
ppdMarkDefaults(ppd);
|
||||
|
||||
if ((conflicts = ppdConflicts(ppd)) == 0)
|
||||
puts("PASS");
|
||||
else
|
||||
{
|
||||
status ++;
|
||||
printf("FAIL (%d conflicts)\n", conflicts);
|
||||
}
|
||||
if ((conflicts = ppdConflicts(ppd)) == 0)
|
||||
puts("PASS");
|
||||
else
|
||||
{
|
||||
status ++;
|
||||
printf("FAIL (%d conflicts)\n", conflicts);
|
||||
}
|
||||
|
||||
fputs("ppdEmitString: ", stdout);
|
||||
if ((s = ppdEmitString(ppd, PPD_ORDER_ANY, 0.0)) != NULL &&
|
||||
!strcmp(s, default_code))
|
||||
puts("PASS");
|
||||
else
|
||||
{
|
||||
printf("FAIL (%d bytes instead of %d)\n", s ? (int)strlen(s) : 0,
|
||||
(int)strlen(default_code));
|
||||
fputs("ppdEmitString: ", stdout);
|
||||
if ((s = ppdEmitString(ppd, PPD_ORDER_ANY, 0.0)) != NULL &&
|
||||
!strcmp(s, default_code))
|
||||
puts("PASS");
|
||||
else
|
||||
{
|
||||
printf("FAIL (%d bytes instead of %d)\n", s ? (int)strlen(s) : 0,
|
||||
(int)strlen(default_code));
|
||||
|
||||
if (s)
|
||||
puts(s);
|
||||
}
|
||||
|
||||
if (s)
|
||||
puts(s);
|
||||
free(s);
|
||||
|
||||
ppdClose(ppd);
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((ppd = ppdOpenFile(argv[1])) == NULL)
|
||||
{
|
||||
ppd_status_t err; /* Last error in file */
|
||||
int line; /* Line number in file */
|
||||
|
||||
if (s)
|
||||
free(s);
|
||||
|
||||
ppdClose(ppd);
|
||||
status ++;
|
||||
err = ppdLastError(&line);
|
||||
|
||||
printf("%s: %s on line %d\n", argv[1], ppdErrorString(err), line);
|
||||
}
|
||||
else
|
||||
{
|
||||
int i, j, k; /* Looping vars */
|
||||
ppd_group_t *group; /* Option group */
|
||||
ppd_option_t *option; /* Option */
|
||||
|
||||
|
||||
ppdLocalize(ppd);
|
||||
|
||||
for (i = ppd->num_groups, group = ppd->groups;
|
||||
i > 0;
|
||||
i --, group ++)
|
||||
{
|
||||
printf("%s (%s):\n", group->name, group->text);
|
||||
|
||||
for (j = group->num_options, option = group->options;
|
||||
j > 0;
|
||||
j --, option ++)
|
||||
{
|
||||
printf(" %s (%s):\n", option->keyword, option->text);
|
||||
|
||||
for (k = 0; k < option->num_choices; k ++)
|
||||
printf(" - %s (%s)\n", option->choices[k].choice,
|
||||
option->choices[k].text);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return (status);
|
||||
}
|
||||
|
||||
@@ -37,6 +37,7 @@
|
||||
* conv_vbcs_to_utf8() - Convert legacy DBCS/VBCS to UTF-8.
|
||||
* free_sbcs_charmap() - Free memory used by a single byte character set.
|
||||
* free_vbcs_charmap() - Free memory used by a variable byte character set.
|
||||
* get_charmap() - Lookup or get a character set map (private).
|
||||
* get_charmap_count() - Count lines in a charmap file.
|
||||
* get_sbcs_charmap() - Get SBCS Charmap.
|
||||
* get_vbcs_charmap() - Get DBCS/VBCS Charmap.
|
||||
@@ -48,11 +49,26 @@
|
||||
|
||||
#include "globals.h"
|
||||
#include "debug.h"
|
||||
#include <limits.h>
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
#include <time.h>
|
||||
|
||||
|
||||
/*
|
||||
* Local globals...
|
||||
*/
|
||||
|
||||
#ifdef HAVE_PTHREAD_H
|
||||
static pthread_mutex_t map_mutex = PTHREAD_MUTEX_INITIALIZER;
|
||||
/* Mutex to control access to maps */
|
||||
#endif /* HAVE_PTHREAD_H */
|
||||
static _cups_cmap_t *cmap_cache = NULL;
|
||||
/* SBCS Charmap Cache */
|
||||
static _cups_vmap_t *vmap_cache = NULL;
|
||||
/* VBCS Charmap Cache */
|
||||
|
||||
|
||||
/*
|
||||
* Local functions...
|
||||
*/
|
||||
@@ -76,6 +92,7 @@ static int conv_vbcs_to_utf8(cups_utf8_t *dest,
|
||||
const cups_encoding_t encoding);
|
||||
static void free_sbcs_charmap(_cups_cmap_t *sbcs);
|
||||
static void free_vbcs_charmap(_cups_vmap_t *vbcs);
|
||||
static void *get_charmap(const cups_encoding_t encoding);
|
||||
static int get_charmap_count(cups_file_t *fp);
|
||||
static _cups_cmap_t *get_sbcs_charmap(const cups_encoding_t encoding,
|
||||
const char *filename);
|
||||
@@ -88,7 +105,7 @@ static _cups_vmap_t *get_vbcs_charmap(const cups_encoding_t encoding,
|
||||
*/
|
||||
|
||||
void
|
||||
_cupsCharmapFlush(_cups_globals_t *cg) /* I - Global data */
|
||||
_cupsCharmapFlush(void)
|
||||
{
|
||||
_cups_cmap_t *cmap, /* Legacy SBCS / Unicode Charset Map */
|
||||
*cnext; /* Next Legacy SBCS Charset Map */
|
||||
@@ -96,24 +113,28 @@ _cupsCharmapFlush(_cups_globals_t *cg) /* I - Global data */
|
||||
*vnext; /* Next Legacy VBCS Charset Map */
|
||||
|
||||
|
||||
#ifdef HAVE_PTHREAD_H
|
||||
pthread_mutex_lock(&map_mutex);
|
||||
#endif /* HAVE_PTHREAD_H */
|
||||
|
||||
/*
|
||||
* Loop through SBCS charset map cache, free all memory...
|
||||
*/
|
||||
|
||||
for (cmap = cg->cmap_cache; cmap; cmap = cnext)
|
||||
for (cmap = cmap_cache; cmap; cmap = cnext)
|
||||
{
|
||||
cnext = cmap->next;
|
||||
|
||||
free_sbcs_charmap(cmap);
|
||||
}
|
||||
|
||||
cg->cmap_cache = NULL;
|
||||
cmap_cache = NULL;
|
||||
|
||||
/*
|
||||
* Loop through DBCS/VBCS charset map cache, free all memory...
|
||||
*/
|
||||
|
||||
for (vmap = cg->vmap_cache; vmap; vmap = vnext)
|
||||
for (vmap = vmap_cache; vmap; vmap = vnext)
|
||||
{
|
||||
vnext = vmap->next;
|
||||
|
||||
@@ -122,7 +143,11 @@ _cupsCharmapFlush(_cups_globals_t *cg) /* I - Global data */
|
||||
free(vmap);
|
||||
}
|
||||
|
||||
cg->vmap_cache = NULL;
|
||||
vmap_cache = NULL;
|
||||
|
||||
#ifdef HAVE_PTHREAD_H
|
||||
pthread_mutex_unlock(&map_mutex);
|
||||
#endif /* HAVE_PTHREAD_H */
|
||||
}
|
||||
|
||||
|
||||
@@ -138,21 +163,23 @@ _cupsCharmapFree(
|
||||
{
|
||||
_cups_cmap_t *cmap; /* Legacy SBCS / Unicode Charset Map */
|
||||
_cups_vmap_t *vmap; /* Legacy VBCS / Unicode Charset Map */
|
||||
_cups_globals_t *cg = _cupsGlobals(); /* Pointer to library globals */
|
||||
|
||||
|
||||
/*
|
||||
* See if we already have this SBCS charset map loaded...
|
||||
*/
|
||||
|
||||
for (cmap = cg->cmap_cache; cmap; cmap = cmap->next)
|
||||
#ifdef HAVE_PTHREAD_H
|
||||
pthread_mutex_lock(&map_mutex);
|
||||
#endif /* HAVE_PTHREAD_H */
|
||||
|
||||
for (cmap = cmap_cache; cmap; cmap = cmap->next)
|
||||
{
|
||||
if (cmap->encoding == encoding)
|
||||
{
|
||||
if (cmap->used > 0)
|
||||
cmap->used --;
|
||||
|
||||
return;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -160,15 +187,19 @@ _cupsCharmapFree(
|
||||
* See if we already have this DBCS/VBCS charset map loaded...
|
||||
*/
|
||||
|
||||
for (vmap = cg->vmap_cache; vmap; vmap = vmap->next)
|
||||
for (vmap = vmap_cache; vmap; vmap = vmap->next)
|
||||
{
|
||||
if (vmap->encoding == encoding)
|
||||
{
|
||||
if (vmap->used > 0)
|
||||
vmap->used --;
|
||||
return;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef HAVE_PTHREAD_H
|
||||
pthread_mutex_unlock(&map_mutex);
|
||||
#endif /* HAVE_PTHREAD_H */
|
||||
}
|
||||
|
||||
|
||||
@@ -185,8 +216,7 @@ void * /* O - Charset map pointer */
|
||||
_cupsCharmapGet(
|
||||
const cups_encoding_t encoding) /* I - Encoding */
|
||||
{
|
||||
char filename[1024]; /* Filename for charset map file */
|
||||
_cups_globals_t *cg = _cupsGlobals(); /* Global data */
|
||||
void *charmap; /* Charset map pointer */
|
||||
|
||||
|
||||
DEBUG_printf(("_cupsCharmapGet(encoding=%d)\n", encoding));
|
||||
@@ -202,24 +232,20 @@ _cupsCharmapGet(
|
||||
}
|
||||
|
||||
/*
|
||||
* Get the data directory and charset map name...
|
||||
* Lookup or get the charset map pointer and return...
|
||||
*/
|
||||
|
||||
snprintf(filename, sizeof(filename), "%s/charmaps/%s.txt",
|
||||
cg->cups_datadir, _cupsEncodingName(encoding));
|
||||
#ifdef HAVE_PTHREAD_H
|
||||
pthread_mutex_lock(&map_mutex);
|
||||
#endif /* HAVE_PTHREAD_H */
|
||||
|
||||
DEBUG_printf((" filename=\"%s\"\n", filename));
|
||||
charmap = get_charmap(encoding);
|
||||
|
||||
/*
|
||||
* Read charset map input file into cache...
|
||||
*/
|
||||
#ifdef HAVE_PTHREAD_H
|
||||
pthread_mutex_unlock(&map_mutex);
|
||||
#endif /* HAVE_PTHREAD_H */
|
||||
|
||||
if (encoding < CUPS_ENCODING_SBCS_END)
|
||||
return (get_sbcs_charmap(encoding, filename));
|
||||
else if (encoding < CUPS_ENCODING_VBCS_END)
|
||||
return (get_vbcs_charmap(encoding, filename));
|
||||
else
|
||||
return (NULL);
|
||||
return (charmap);
|
||||
}
|
||||
|
||||
|
||||
@@ -239,6 +265,9 @@ cupsCharsetToUTF8(
|
||||
const int maxout, /* I - Max output */
|
||||
const cups_encoding_t encoding) /* I - Encoding */
|
||||
{
|
||||
int bytes; /* Number of bytes converted */
|
||||
|
||||
|
||||
/*
|
||||
* Check for valid arguments...
|
||||
*/
|
||||
@@ -270,15 +299,25 @@ cupsCharsetToUTF8(
|
||||
* Convert input legacy charset to UTF-8...
|
||||
*/
|
||||
|
||||
#ifdef HAVE_PTHREAD_H
|
||||
pthread_mutex_lock(&map_mutex);
|
||||
#endif /* HAVE_PTHREAD_H */
|
||||
|
||||
if (encoding < CUPS_ENCODING_SBCS_END)
|
||||
return (conv_sbcs_to_utf8(dest, (cups_sbcs_t *)src, maxout, encoding));
|
||||
bytes = conv_sbcs_to_utf8(dest, (cups_sbcs_t *)src, maxout, encoding);
|
||||
else if (encoding < CUPS_ENCODING_VBCS_END)
|
||||
return (conv_vbcs_to_utf8(dest, (cups_sbcs_t *)src, maxout, encoding));
|
||||
bytes = conv_vbcs_to_utf8(dest, (cups_sbcs_t *)src, maxout, encoding);
|
||||
else
|
||||
{
|
||||
puts(" Bad encoding, returning -1");
|
||||
return (-1);
|
||||
DEBUG_puts(" Bad encoding, returning -1");
|
||||
bytes = -1;
|
||||
}
|
||||
|
||||
#ifdef HAVE_PTHREAD_H
|
||||
pthread_mutex_unlock(&map_mutex);
|
||||
#endif /* HAVE_PTHREAD_H */
|
||||
|
||||
return (bytes);
|
||||
}
|
||||
|
||||
|
||||
@@ -298,6 +337,9 @@ cupsUTF8ToCharset(
|
||||
const int maxout, /* I - Max output */
|
||||
const cups_encoding_t encoding) /* I - Encoding */
|
||||
{
|
||||
int bytes; /* Number of bytes converted */
|
||||
|
||||
|
||||
/*
|
||||
* Check for valid arguments...
|
||||
*/
|
||||
@@ -325,12 +367,22 @@ cupsUTF8ToCharset(
|
||||
* Convert input UTF-8 to legacy charset...
|
||||
*/
|
||||
|
||||
#ifdef HAVE_PTHREAD_H
|
||||
pthread_mutex_lock(&map_mutex);
|
||||
#endif /* HAVE_PTHREAD_H */
|
||||
|
||||
if (encoding < CUPS_ENCODING_SBCS_END)
|
||||
return (conv_utf8_to_sbcs((cups_sbcs_t *)dest, src, maxout, encoding));
|
||||
bytes = conv_utf8_to_sbcs((cups_sbcs_t *)dest, src, maxout, encoding);
|
||||
else if (encoding < CUPS_ENCODING_VBCS_END)
|
||||
return (conv_utf8_to_vbcs((cups_sbcs_t *)dest, src, maxout, encoding));
|
||||
bytes = conv_utf8_to_vbcs((cups_sbcs_t *)dest, src, maxout, encoding);
|
||||
else
|
||||
return (-1);
|
||||
bytes = -1;
|
||||
|
||||
#ifdef HAVE_PTHREAD_H
|
||||
pthread_mutex_unlock(&map_mutex);
|
||||
#endif /* HAVE_PTHREAD_H */
|
||||
|
||||
return (bytes);
|
||||
}
|
||||
|
||||
|
||||
@@ -675,7 +727,7 @@ conv_sbcs_to_utf8(
|
||||
* Find legacy charset map in cache...
|
||||
*/
|
||||
|
||||
if ((cmap = (_cups_cmap_t *)_cupsCharmapGet(encoding)) == NULL)
|
||||
if ((cmap = (_cups_cmap_t *)get_charmap(encoding)) == NULL)
|
||||
return (-1);
|
||||
|
||||
/*
|
||||
@@ -714,7 +766,7 @@ conv_sbcs_to_utf8(
|
||||
* Convert internal UCS-4 to output UTF-8 (and delete BOM)...
|
||||
*/
|
||||
|
||||
_cupsCharmapFree(encoding);
|
||||
cmap->used --;
|
||||
|
||||
return (cupsUTF32ToUTF8(dest, work, maxout));
|
||||
}
|
||||
@@ -743,7 +795,7 @@ conv_utf8_to_sbcs(
|
||||
* Find legacy charset map in cache...
|
||||
*/
|
||||
|
||||
if ((cmap = (_cups_cmap_t *) _cupsCharmapGet(encoding)) == NULL)
|
||||
if ((cmap = (_cups_cmap_t *)get_charmap(encoding)) == NULL)
|
||||
return (-1);
|
||||
|
||||
/*
|
||||
@@ -790,7 +842,7 @@ conv_utf8_to_sbcs(
|
||||
|
||||
*dest = '\0';
|
||||
|
||||
_cupsCharmapFree(encoding);
|
||||
cmap->used --;
|
||||
|
||||
return ((int)(dest - start));
|
||||
}
|
||||
@@ -820,7 +872,7 @@ conv_utf8_to_vbcs(
|
||||
* Find legacy charset map in cache...
|
||||
*/
|
||||
|
||||
if ((vmap = (_cups_vmap_t *)_cupsCharmapGet(encoding)) == NULL)
|
||||
if ((vmap = (_cups_vmap_t *)get_charmap(encoding)) == NULL)
|
||||
return (-1);
|
||||
|
||||
/*
|
||||
@@ -902,7 +954,7 @@ conv_utf8_to_vbcs(
|
||||
|
||||
*dest = '\0';
|
||||
|
||||
_cupsCharmapFree(encoding);
|
||||
vmap->used --;
|
||||
|
||||
return ((int)(dest - start));
|
||||
}
|
||||
@@ -932,7 +984,7 @@ conv_vbcs_to_utf8(
|
||||
* Find legacy charset map in cache...
|
||||
*/
|
||||
|
||||
if ((vmap = (_cups_vmap_t *)_cupsCharmapGet(encoding)) == NULL)
|
||||
if ((vmap = (_cups_vmap_t *)get_charmap(encoding)) == NULL)
|
||||
return (-1);
|
||||
|
||||
/*
|
||||
@@ -1027,7 +1079,7 @@ conv_vbcs_to_utf8(
|
||||
|
||||
*workptr = 0;
|
||||
|
||||
_cupsCharmapFree(encoding);
|
||||
vmap->used --;
|
||||
|
||||
/*
|
||||
* Convert internal UCS-4 to output UTF-8 (and delete BOM)...
|
||||
@@ -1080,6 +1132,46 @@ free_vbcs_charmap(_cups_vmap_t *vmap) /* I - Character set */
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'get_charmap()' - Lookup or get a character set map (private).
|
||||
*
|
||||
* This code handles single-byte (SBCS), double-byte (DBCS), and
|
||||
* variable-byte (VBCS) character sets _without_ charset escapes...
|
||||
* This code does not handle multiple-byte character sets (MBCS)
|
||||
* (such as ISO-2022-JP) with charset switching via escapes...
|
||||
*/
|
||||
|
||||
|
||||
void * /* O - Charset map pointer */
|
||||
get_charmap(
|
||||
const cups_encoding_t encoding) /* I - Encoding */
|
||||
{
|
||||
char filename[1024]; /* Filename for charset map file */
|
||||
_cups_globals_t *cg = _cupsGlobals(); /* Global data */
|
||||
|
||||
|
||||
/*
|
||||
* Get the data directory and charset map name...
|
||||
*/
|
||||
|
||||
snprintf(filename, sizeof(filename), "%s/charmaps/%s.txt",
|
||||
cg->cups_datadir, _cupsEncodingName(encoding));
|
||||
|
||||
DEBUG_printf((" filename=\"%s\"\n", filename));
|
||||
|
||||
/*
|
||||
* Read charset map input file into cache...
|
||||
*/
|
||||
|
||||
if (encoding < CUPS_ENCODING_SBCS_END)
|
||||
return (get_sbcs_charmap(encoding, filename));
|
||||
else if (encoding < CUPS_ENCODING_VBCS_END)
|
||||
return (get_vbcs_charmap(encoding, filename));
|
||||
else
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'get_charmap_count()' - Count lines in a charmap file.
|
||||
*/
|
||||
@@ -1129,19 +1221,19 @@ get_sbcs_charmap(
|
||||
cups_ucs2_t *crow; /* Pointer to UCS-2 row in 'char2uni' */
|
||||
cups_sbcs_t *srow; /* Pointer to SBCS row in 'uni2char' */
|
||||
char line[256]; /* Line from charset map file */
|
||||
_cups_globals_t *cg = _cupsGlobals(); /* Pointer to library globals */
|
||||
|
||||
|
||||
/*
|
||||
* See if we already have this SBCS charset map loaded...
|
||||
*/
|
||||
|
||||
for (cmap = cg->cmap_cache; cmap; cmap = cmap->next)
|
||||
for (cmap = cmap_cache; cmap; cmap = cmap->next)
|
||||
{
|
||||
if (cmap->encoding == encoding)
|
||||
{
|
||||
cmap->used ++;
|
||||
DEBUG_printf((" returning existing cmap=%p\n", cmap));
|
||||
|
||||
return ((void *)cmap);
|
||||
}
|
||||
}
|
||||
@@ -1161,6 +1253,7 @@ get_sbcs_charmap(
|
||||
{
|
||||
cupsFileClose(fp);
|
||||
DEBUG_puts(" Unable to allocate memory!");
|
||||
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
@@ -1228,8 +1321,8 @@ get_sbcs_charmap(
|
||||
* Add it to the cache and return...
|
||||
*/
|
||||
|
||||
cmap->next = cg->cmap_cache;
|
||||
cg->cmap_cache = cmap;
|
||||
cmap->next = cmap_cache;
|
||||
cmap_cache = cmap;
|
||||
|
||||
DEBUG_printf((" returning new cmap=%p\n", cmap));
|
||||
|
||||
@@ -1273,7 +1366,6 @@ get_vbcs_charmap(
|
||||
char line[256]; /* Line from charset map file */
|
||||
int i; /* Loop variable */
|
||||
int wide; /* 32-bit legacy char */
|
||||
_cups_globals_t *cg = _cupsGlobals(); /* Pointer to library globals */
|
||||
|
||||
|
||||
DEBUG_printf(("get_vbcs_charmap(encoding=%d, filename=\"%s\")\n",
|
||||
@@ -1283,12 +1375,13 @@ get_vbcs_charmap(
|
||||
* See if we already have this DBCS/VBCS charset map loaded...
|
||||
*/
|
||||
|
||||
for (vmap = cg->vmap_cache; vmap; vmap = vmap->next)
|
||||
for (vmap = vmap_cache; vmap; vmap = vmap->next)
|
||||
{
|
||||
if (vmap->encoding == encoding)
|
||||
{
|
||||
vmap->used ++;
|
||||
DEBUG_printf((" returning existing vmap=%p\n", vmap));
|
||||
|
||||
return ((void *)vmap);
|
||||
}
|
||||
}
|
||||
@@ -1300,6 +1393,7 @@ get_vbcs_charmap(
|
||||
if ((fp = cupsFileOpen(filename, "r")) == NULL)
|
||||
{
|
||||
DEBUG_printf((" Unable to open file: %s\n", strerror(errno)));
|
||||
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
@@ -1310,6 +1404,7 @@ get_vbcs_charmap(
|
||||
if ((mapcount = get_charmap_count(fp)) <= 0)
|
||||
{
|
||||
DEBUG_puts(" Unable to get charmap count!");
|
||||
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
@@ -1323,6 +1418,7 @@ get_vbcs_charmap(
|
||||
{
|
||||
cupsFileClose(fp);
|
||||
DEBUG_puts(" Unable to allocate memory!");
|
||||
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
@@ -1465,8 +1561,8 @@ get_vbcs_charmap(
|
||||
* Add it to the cache and return...
|
||||
*/
|
||||
|
||||
vmap->next = cg->vmap_cache;
|
||||
cg->vmap_cache = vmap;
|
||||
vmap->next = vmap_cache;
|
||||
vmap_cache = vmap;
|
||||
|
||||
DEBUG_printf((" returning new vmap=%p\n", vmap));
|
||||
|
||||
|
||||
@@ -17,3 +17,5 @@ Type=Application
|
||||
X-DCOP-ServiceType=
|
||||
X-KDE-SubstituteUID=false
|
||||
X-KDE-Username=
|
||||
Name[es]=Administrar impresión
|
||||
Comment[es]=Interfaz Web de CUPS
|
||||
|
||||
@@ -160,13 +160,13 @@ HELPFILES = \
|
||||
help/ref-error_log.html \
|
||||
help/ref-page_log.html \
|
||||
help/ref-printers-conf.html \
|
||||
help/ref-snmp-conf.html \
|
||||
help/ref-subscriptions-conf.html \
|
||||
help/security.html \
|
||||
help/spec-cmp.html \
|
||||
help/spec-command.html \
|
||||
help/spec-design.html \
|
||||
help/spec-ipp.html \
|
||||
help/spec-postscript.html \
|
||||
help/spec-ppd.html \
|
||||
help/spec-raster.html \
|
||||
help/spec-stp.html \
|
||||
|
||||
@@ -133,7 +133,7 @@ WIDTH="15" HEIGHT="15" ALT=""></TD>
|
||||
|
||||
<P><SMALL>Common UNIX Printing System, CUPS, y el logo de CUPS son
|
||||
marcas registradas de <A HREF="http://www.easysw.com">Easy Software
|
||||
Products</A>. Los derechos de copia de CUPS 1997-2006 son de Easy Software Products,
|
||||
Products</A>. Los derechos de copia de CUPS 1997-2006 son de Easy Software Products.
|
||||
Todos los derechos reservados.</SMALL></P>
|
||||
|
||||
</TD>
|
||||
|
||||
@@ -189,14 +189,19 @@ library:</p>
|
||||
<li><a href='#ppdErrorString'><tt>ppdErrorString()</tt></a> <span class='info'> CUPS 1.1.19 </span></li>
|
||||
<li><a href='#ppdFindAttr'><tt>ppdFindAttr()</tt></a> <span class='info'> CUPS 1.1.19 </span></li>
|
||||
<li><a href='#ppdFindChoice'><tt>ppdFindChoice()</tt></a> </li>
|
||||
<li><a href='#ppdFindCustomOption'><tt>ppdFindCustomOption()</tt></a> <span class='info'> CUPS 1.2 </span></li>
|
||||
<li><a href='#ppdFindCustomParam'><tt>ppdFindCustomParam()</tt></a> <span class='info'> CUPS 1.2 </span></li>
|
||||
<li><a href='#ppdFindMarkedChoice'><tt>ppdFindMarkedChoice()</tt></a> </li>
|
||||
<li><a href='#ppdFindNextAttr'><tt>ppdFindNextAttr()</tt></a> <span class='info'> CUPS 1.1.19 </span></li>
|
||||
<li><a href='#ppdFindOption'><tt>ppdFindOption()</tt></a> </li>
|
||||
<li><a href='#ppdFirstCustomParam'><tt>ppdFirstCustomParam()</tt></a> <span class='info'> CUPS 1.2 </span></li>
|
||||
<li><a href='#ppdFirstOption'><tt>ppdFirstOption()</tt></a> <span class='info'> CUPS 1.2 </span></li>
|
||||
<li><a href='#ppdIsMarked'><tt>ppdIsMarked()</tt></a> </li>
|
||||
<li><a href='#ppdLastError'><tt>ppdLastError()</tt></a> <span class='info'> CUPS 1.1.19 </span></li>
|
||||
<li><a href='#ppdLocalize'><tt>ppdLocalize()</tt></a> <span class='info'> CUPS 1.2 </span></li>
|
||||
<li><a href='#ppdMarkDefaults'><tt>ppdMarkDefaults()</tt></a> </li>
|
||||
<li><a href='#ppdMarkOption'><tt>ppdMarkOption()</tt></a> </li>
|
||||
<li><a href='#ppdNextCustomParam'><tt>ppdNextCustomParam()</tt></a> <span class='info'> CUPS 1.2 </span></li>
|
||||
<li><a href='#ppdNextOption'><tt>ppdNextOption()</tt></a> <span class='info'> CUPS 1.2 </span></li>
|
||||
<li><a href='#ppdOpen'><tt>ppdOpen()</tt></a> </li>
|
||||
<li><a href='#ppdOpen2'><tt>ppdOpen2()</tt></a> <span class='info'> CUPS 1.2 </span></li>
|
||||
@@ -515,6 +520,50 @@ ppdFindChoice(
|
||||
<h4>Returns</h4>
|
||||
<p>Choice pointer or NULL</p>
|
||||
<!-- NEW PAGE -->
|
||||
<h3 class='title'><span class='info'> CUPS 1.2 </span><a name='ppdFindCustomOption'>ppdFindCustomOption()</a></h3>
|
||||
<h4>Description</h4>
|
||||
<p>Find a custom option.
|
||||
|
||||
</p>
|
||||
<h4>Syntax</h4>
|
||||
<pre>
|
||||
<a href='#ppd_coption_t'>ppd_coption_t</a> *
|
||||
ppdFindCustomOption(
|
||||
<a href='#ppd_file_t'>ppd_file_t</a> * ppd,
|
||||
const char * keyword);
|
||||
</pre>
|
||||
<h4>Arguments</h4>
|
||||
<div class='table'><table align='center' border='1' width='80%' cellpadding='5' cellspacing='0'>
|
||||
<thead><tr><th>Name</th><th>Description</th></tr></thead>
|
||||
<tbody>
|
||||
<tr><td><tt>ppd</tt></td><td>PPD file</td></tr>
|
||||
<tr><td><tt>keyword</tt></td><td>Custom option name</td></tr>
|
||||
</tbody></table></div>
|
||||
<h4>Returns</h4>
|
||||
<p>Custom option or NULL</p>
|
||||
<!-- NEW PAGE -->
|
||||
<h3 class='title'><span class='info'> CUPS 1.2 </span><a name='ppdFindCustomParam'>ppdFindCustomParam()</a></h3>
|
||||
<h4>Description</h4>
|
||||
<p>Find a parameter for a custom option.
|
||||
|
||||
</p>
|
||||
<h4>Syntax</h4>
|
||||
<pre>
|
||||
<a href='#ppd_cparam_t'>ppd_cparam_t</a> *
|
||||
ppdFindCustomParam(
|
||||
<a href='#ppd_coption_t'>ppd_coption_t</a> * opt,
|
||||
const char * name);
|
||||
</pre>
|
||||
<h4>Arguments</h4>
|
||||
<div class='table'><table align='center' border='1' width='80%' cellpadding='5' cellspacing='0'>
|
||||
<thead><tr><th>Name</th><th>Description</th></tr></thead>
|
||||
<tbody>
|
||||
<tr><td><tt>opt</tt></td><td>Custom option</td></tr>
|
||||
<tr><td><tt>name</tt></td><td>Parameter name</td></tr>
|
||||
</tbody></table></div>
|
||||
<h4>Returns</h4>
|
||||
<p>Custom parameter or NULL</p>
|
||||
<!-- NEW PAGE -->
|
||||
<h3 class='title'><a name='ppdFindMarkedChoice'>ppdFindMarkedChoice()</a></h3>
|
||||
<h4>Description</h4>
|
||||
<p>Return the marked choice for the specified option.</p>
|
||||
@@ -579,6 +628,26 @@ ppdFindOption(
|
||||
<h4>Returns</h4>
|
||||
<p>Pointer to option or NULL</p>
|
||||
<!-- NEW PAGE -->
|
||||
<h3 class='title'><span class='info'> CUPS 1.2 </span><a name='ppdFirstCustomParam'>ppdFirstCustomParam()</a></h3>
|
||||
<h4>Description</h4>
|
||||
<p>Return the first parameter for a custom option.
|
||||
|
||||
</p>
|
||||
<h4>Syntax</h4>
|
||||
<pre>
|
||||
<a href='#ppd_cparam_t'>ppd_cparam_t</a> *
|
||||
ppdFirstCustomParam(
|
||||
<a href='#ppd_coption_t'>ppd_coption_t</a> * opt);
|
||||
</pre>
|
||||
<h4>Arguments</h4>
|
||||
<div class='table'><table align='center' border='1' width='80%' cellpadding='5' cellspacing='0'>
|
||||
<thead><tr><th>Name</th><th>Description</th></tr></thead>
|
||||
<tbody>
|
||||
<tr><td><tt>opt</tt></td><td>Custom option</td></tr>
|
||||
</tbody></table></div>
|
||||
<h4>Returns</h4>
|
||||
<p>Custom parameter or NULL</p>
|
||||
<!-- NEW PAGE -->
|
||||
<h3 class='title'><span class='info'> CUPS 1.2 </span><a name='ppdFirstOption'>ppdFirstOption()</a></h3>
|
||||
<h4>Description</h4>
|
||||
<p>Return the first option in the PPD file.
|
||||
@@ -643,6 +712,26 @@ ppdLastError(
|
||||
<h4>Returns</h4>
|
||||
<p>Status code</p>
|
||||
<!-- NEW PAGE -->
|
||||
<h3 class='title'><span class='info'> CUPS 1.2 </span><a name='ppdLocalize'>ppdLocalize()</a></h3>
|
||||
<h4>Description</h4>
|
||||
<p>Localize the PPD file to the current locale.
|
||||
|
||||
</p>
|
||||
<h4>Syntax</h4>
|
||||
<pre>
|
||||
int
|
||||
ppdLocalize(
|
||||
<a href='#ppd_file_t'>ppd_file_t</a> * ppd);
|
||||
</pre>
|
||||
<h4>Arguments</h4>
|
||||
<div class='table'><table align='center' border='1' width='80%' cellpadding='5' cellspacing='0'>
|
||||
<thead><tr><th>Name</th><th>Description</th></tr></thead>
|
||||
<tbody>
|
||||
<tr><td><tt>ppd</tt></td><td>PPD file</td></tr>
|
||||
</tbody></table></div>
|
||||
<h4>Returns</h4>
|
||||
<p>0 on success, -1 on error</p>
|
||||
<!-- NEW PAGE -->
|
||||
<h3 class='title'><a name='ppdMarkDefaults'>ppdMarkDefaults()</a></h3>
|
||||
<h4>Description</h4>
|
||||
<p>Mark all default options in the PPD file.</p>
|
||||
@@ -688,6 +777,26 @@ ppdMarkOption(
|
||||
<h4>Returns</h4>
|
||||
<p>Number of conflicts</p>
|
||||
<!-- NEW PAGE -->
|
||||
<h3 class='title'><span class='info'> CUPS 1.2 </span><a name='ppdNextCustomParam'>ppdNextCustomParam()</a></h3>
|
||||
<h4>Description</h4>
|
||||
<p>Return the next parameter for a custom option.
|
||||
|
||||
</p>
|
||||
<h4>Syntax</h4>
|
||||
<pre>
|
||||
<a href='#ppd_cparam_t'>ppd_cparam_t</a> *
|
||||
ppdNextCustomParam(
|
||||
<a href='#ppd_coption_t'>ppd_coption_t</a> * opt);
|
||||
</pre>
|
||||
<h4>Arguments</h4>
|
||||
<div class='table'><table align='center' border='1' width='80%' cellpadding='5' cellspacing='0'>
|
||||
<thead><tr><th>Name</th><th>Description</th></tr></thead>
|
||||
<tbody>
|
||||
<tr><td><tt>opt</tt></td><td>Custom option</td></tr>
|
||||
</tbody></table></div>
|
||||
<h4>Returns</h4>
|
||||
<p>Custom parameter or NULL</p>
|
||||
<!-- NEW PAGE -->
|
||||
<h3 class='title'><span class='info'> CUPS 1.2 </span><a name='ppdNextOption'>ppdNextOption()</a></h3>
|
||||
<h4>Description</h4>
|
||||
<p>Return the next option in the PPD file.
|
||||
|
||||
@@ -5,58 +5,49 @@
|
||||
</HEAD>
|
||||
<BODY>
|
||||
|
||||
<P>The <VAR>/etc/cups/client.conf</VAR> file contains many
|
||||
directives that determine how the client behaves:</P>
|
||||
<P>The <VAR>/etc/cups/client.conf</VAR> and
|
||||
<VAR>~/.cups/client.conf</VAR> files contain up to two directives
|
||||
that determine how the client behaves. Each directive is listed
|
||||
on a line by itself followed by its value. Comments are
|
||||
introduced using the number sign ("#") character at the beginning
|
||||
of a line.</P>
|
||||
|
||||
<P ALIGN="CENTER">
|
||||
<TABLE CELLPADDING="0" CELLSPACING="0" BORDER="0">
|
||||
<TR>
|
||||
<TD VALIGN="TOP">
|
||||
<H2 CLASS="title"><A NAME="Encryption">Encryption</A></H2>
|
||||
|
||||
<LI><A HREF="#Encryption"><CODE>Encryption</CODE></A>
|
||||
<LI><A HREF="#ServerName"><CODE>ServerName</CODE></A>
|
||||
<H3>Examples</H3>
|
||||
|
||||
</TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
</P>
|
||||
|
||||
<!-- HALF PAGE -->
|
||||
<H3><A NAME="Encryption">Encryption</A></H3>
|
||||
<HR>
|
||||
|
||||
<H4>Examples</H4>
|
||||
|
||||
<UL><PRE>
|
||||
<PRE CLASS="command">
|
||||
Encryption Never
|
||||
Encryption IfRequested
|
||||
Encryption Required
|
||||
Encryption Always
|
||||
</PRE></UL>
|
||||
</PRE>
|
||||
|
||||
<H4>Description</H4>
|
||||
<H3>Description</H3>
|
||||
|
||||
<P>The <CODE>Encryption</CODE> directive specifies the default encryption settings for the client.
|
||||
The default setting is <VAR>IfRequested</VAR>.
|
||||
<P>The <CODE>Encryption</CODE> directive specifies the default
|
||||
encryption settings for the client.</P>
|
||||
|
||||
<P>The default setting is <VAR>IfRequested</VAR>.</P>
|
||||
|
||||
|
||||
<!-- HALF PAGE -->
|
||||
<H3><A NAME="ServerName">ServerName</A></H3>
|
||||
<HR>
|
||||
<H2 CLASS="title"><A NAME="ServerName">ServerName</A></H2>
|
||||
|
||||
<H4>Examples</H4>
|
||||
<H3>Examples</H3>
|
||||
|
||||
<UL><PRE>
|
||||
<PRE CLASS="command">
|
||||
ServerName foo.bar.com
|
||||
ServerName 11.22.33.44
|
||||
</PRE></UL>
|
||||
</PRE>
|
||||
|
||||
<H4>Description</H4>
|
||||
<H3>Description</H3>
|
||||
|
||||
<P>The <CODE>ServerName</CODE> directive specifies sets the remote server that is to be used
|
||||
for all client operations. That is, it redirects all client requests to the remote server.
|
||||
<P>The <CODE>ServerName</CODE> directive specifies sets the
|
||||
remote server that is to be used for all client operations. That
|
||||
is, it redirects all client requests to the remote server.</P>
|
||||
|
||||
The default is to use the local server ("<VAR>localhost</VAR>").
|
||||
<P>The default is to use the local server
|
||||
("<VAR>localhost</VAR>") or domain socket, if so configured.</P>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
|
||||
@@ -929,6 +929,22 @@ policy to use for IPP operation. The default is
|
||||
<CODE>default</CODE>.</P>
|
||||
|
||||
|
||||
<H2 CLASS="title"><SPAN CLASS="info">CUPS 1.2</SPAN><A NAME="DefaultShared">DefaultShared</A></H2>
|
||||
|
||||
<H3>Examples</H3>
|
||||
|
||||
<PRE CLASS="command">
|
||||
DefaultShared yes
|
||||
DefaultShared no
|
||||
</PRE>
|
||||
|
||||
<H3>Description</H3>
|
||||
|
||||
<P>The <CODE>DefaultShared</CODE> directive specifies whether
|
||||
printers are shared (published) by default. The default is
|
||||
<CODE>yes</CODE>.</P>
|
||||
|
||||
|
||||
<H2 CLASS="title"><A NAME="Deny">Deny</A></H2>
|
||||
|
||||
<H3>Examples</H3>
|
||||
@@ -2667,6 +2683,28 @@ to wait before an active HTTP or IPP request times out. The
|
||||
default timeout is 300 seconds.</P>
|
||||
|
||||
|
||||
<H2 CLASS="title"><SPAN CLASS="info">CUPS 1.2</SPAN><A NAME="UseNetworkDefault">UseNetworkDefault</A></H2>
|
||||
|
||||
<H3>Examples</H3>
|
||||
|
||||
<PRE CLASS="command">
|
||||
UseNetworkDefault yes
|
||||
UseNetworkDefault no
|
||||
</PRE>
|
||||
|
||||
<H3>Description</H3>
|
||||
|
||||
<P>The <CODE>UseNetworkDefault</CODE> directive controls whether
|
||||
the client will use a network/remote printer as a default
|
||||
printer. If enabled, the default printer of a server is used as
|
||||
the default printer on a client. When multiple servers are
|
||||
advertising a default printer, the client's default printer is
|
||||
set to the first discovered printer, or to the implicit class for
|
||||
the same printer available from multiple servers.</P>
|
||||
|
||||
<P>The default is <CODE>yes</CODE>.</P>
|
||||
|
||||
|
||||
<H2 CLASS="title"><A NAME="User">User</A></H2>
|
||||
|
||||
<H3>Examples</H3>
|
||||
|
||||
@@ -0,0 +1,100 @@
|
||||
<HTML>
|
||||
<!-- SECTION: References -->
|
||||
<HEAD>
|
||||
<TITLE>snmp.conf</TITLE>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
|
||||
<P>The <VAR>/etc/cups/snmp.conf</VAR> file contains several
|
||||
directives that determine how the SNMP printer discovery backend
|
||||
behaves. Each directive is listed on a line by itself followed
|
||||
by its value. Comments are introduced using the number sign ("#")
|
||||
character at the beginning of a line.</P>
|
||||
|
||||
<P>The SNMP backend uses the SNMPv1 protocol to discover network
|
||||
printers, collecting information from the Host MIB along with
|
||||
intelligent port probes to determine the correct device URI and
|
||||
make and model for each printer. Future versions of CUPS will
|
||||
likely support the new Port Monitor MIB as well.</P>
|
||||
|
||||
<H2 CLASS="title"><A NAME="Address">Address</A></H2>
|
||||
|
||||
<H3>Examples</H3>
|
||||
|
||||
<PRE CLASS="command">
|
||||
Address @LOCAL
|
||||
Address @IF(name)
|
||||
Address 255.255.255.255
|
||||
Address 192.168.2.255
|
||||
</PRE>
|
||||
|
||||
<H3>Description</H3>
|
||||
|
||||
<P>The <CODE>Address</CODE> directive specifies a broadcast
|
||||
address to use when discovering printers. Multiple
|
||||
<CODE>Address</CODE> lines can be provided to scan different
|
||||
subnets.</P>
|
||||
|
||||
<P>The default address is <VAR>@LOCAL</VAR>, which broadcasts to
|
||||
all LANs.</P>
|
||||
|
||||
|
||||
<H2 CLASS="title"><A NAME="Community">Community</A></H2>
|
||||
|
||||
<H3>Examples</H3>
|
||||
|
||||
<PRE CLASS="command">
|
||||
Community public
|
||||
Community easysw
|
||||
Community BigCorp
|
||||
</PRE>
|
||||
|
||||
<H3>Description</H3>
|
||||
|
||||
<P>The <CODE>Community</CODE> directive specifies a community
|
||||
name to use when discovering printers. Multiple
|
||||
<CODE>Community</CODE> lines can be provided to scan different
|
||||
SNMP communities.</P>
|
||||
|
||||
<P>The default community is "public".</P>
|
||||
|
||||
|
||||
<H2 CLASS="title"><A NAME="DebugLevel">DebugLevel</A></H2>
|
||||
|
||||
<H3>Examples</H3>
|
||||
|
||||
<PRE CLASS="command">
|
||||
DebugLevel 0
|
||||
DebugLevel 1
|
||||
DebugLevel 2
|
||||
DebugLevel 3
|
||||
</PRE>
|
||||
|
||||
<H3>Description</H3>
|
||||
|
||||
<P>The <CODE>DebugLevel</CODE> directive specifies the debugging
|
||||
level to use when searching for network printers. Level 0
|
||||
produces no debugging information. Level 1 produces basic
|
||||
debugging information. Level 2 adds printing of the SNMP
|
||||
messages. Level 3 adds a hex dump of the network data.</P>
|
||||
|
||||
<P>The default setting is <VAR>0</VAR>.</P>
|
||||
|
||||
<H2 CLASS="title"><A NAME="HostNameLookups">HostNameLookups</A></H2>
|
||||
|
||||
<H3>Examples</H3>
|
||||
|
||||
<PRE CLASS="command">
|
||||
HostNameLookups on
|
||||
HostNameLookups off
|
||||
</PRE>
|
||||
|
||||
<H3>Description</H3>
|
||||
|
||||
<P>The <CODE>HostNameLookups</CODE> directive specifies whether printer
|
||||
addresses are converted to hostnames or left as numeric IP addresses.</P>
|
||||
|
||||
<P>The default setting is <VAR>off</VAR>.</P>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
@@ -1,120 +0,0 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
|
||||
<html>
|
||||
<!-- SECTION: Specifications -->
|
||||
<head>
|
||||
<title>Generating PostScript for CUPS</title>
|
||||
<meta name='keywords' content='Programming, PostScript, Document Structuring Conventions'>
|
||||
<link rel='stylesheet' type='text/css' href='../cups.css'>
|
||||
</head>
|
||||
<body>
|
||||
<!--
|
||||
"$Id$"
|
||||
|
||||
CUPS PostScript file specification for the Common UNIX Printing System (CUPS).
|
||||
|
||||
Copyright 2006 by Easy Software Products.
|
||||
|
||||
These coded instructions, statements, and computer programs are the
|
||||
property of Easy Software Products and are protected by Federal
|
||||
copyright law. Distribution and use rights are outlined in the file
|
||||
"LICENSE.txt" which should have been included with this file. If this
|
||||
file is missing or damaged please contact Easy Software Products
|
||||
at:
|
||||
|
||||
Attn: CUPS Licensing Information
|
||||
Easy Software Products
|
||||
44141 Airport View Drive, Suite 204
|
||||
Hollywood, Maryland 20636 USA
|
||||
|
||||
Voice: (301) 373-9600
|
||||
EMail: cups-info@cups.org
|
||||
WWW: http://www.cups.org
|
||||
-->
|
||||
|
||||
<h2 class='title'><a name='INTRODUCTION'>Introduction</a></h2>
|
||||
|
||||
<p>This document describes how to generate PostScript output for
|
||||
CUPS and is largely based on the <a
|
||||
href="http://partners.adobe.com/public/developer/en/ps/5001.DSC_Spec.pdf">
|
||||
Adobe TechNote #5001: PostScript Language Document Structuring
|
||||
Conventions Specification Version 3.0</a>. While CUPS can
|
||||
generally print any PostScript file, following the rules in the
|
||||
Adobe TechNote and this document will ensure that your PostScript
|
||||
output will work reliably.</p>
|
||||
|
||||
<blockquote><b>Note:</b> While PostScript is currently the
|
||||
defacto-standard print job file format/language for UNIX-based
|
||||
applications, it is slowly being phased out in favor of Adobe's
|
||||
Portable Document Format ("PDF") which offers many advantages
|
||||
over PostScript. MacOS X uses PDF as the primary print job file
|
||||
format, and we expect Linux to soon follow. Both PostScript and
|
||||
PDF are complex formats, and we highly recommend using high-level
|
||||
toolkits whenever possible.</blockquote>
|
||||
|
||||
<h3>Anatomy of a PostScript File</h3>
|
||||
|
||||
<p>PostScript files are ASCII text files starting with a header
|
||||
line (<tt>%!PS-Adobe-3.0</tt>) followed by a combination of
|
||||
comment lines starting with two percent signs (<tt>%%</tt>) and
|
||||
PostScript code lines. The lines themselves should not exceed 255
|
||||
characters to conform to the DSC. The following short PostScript
|
||||
file produces a box with a smiley face in it:</p>
|
||||
|
||||
<pre class="command">
|
||||
%!PS-Adobe-3.0
|
||||
%%BoundingBox: 36 36 576 756
|
||||
%%Pages: 1
|
||||
%%LanguageLevel: 2
|
||||
%%EndComments
|
||||
%%Page: (1) 1
|
||||
% Draw a black box around the page
|
||||
0 setgray
|
||||
1 setlinewidth
|
||||
36 36 540 720 rectstroke
|
||||
|
||||
% Draw a two inch blue circle in the middle of the page
|
||||
0 0 1 setrgbcolor
|
||||
306 396 144 0 360 arc closepath fill
|
||||
|
||||
% Draw two half inch yellow circles for eyes
|
||||
1 1 0 setrgbcolor
|
||||
252 432 36 0 360 arc closepath fill
|
||||
360 432 36 0 360 arc closepath fill
|
||||
|
||||
% Draw the smile
|
||||
1 setlinecap
|
||||
18 setlinewidth
|
||||
306 396 99 200 340 arc stroke
|
||||
|
||||
% Print it!
|
||||
showpage
|
||||
%%EOF
|
||||
</pre>
|
||||
|
||||
<div class="figure"><table summary="Sample PostScript File Output">
|
||||
<caption>Figure 1: <a name="FIGURE_1">Sample PostScript File Output</a></caption>
|
||||
<tr><td align="center"><img src="../images/smiley.jpg"
|
||||
width="445" height="570" alt="Sample PostScript File Output"></td></tr>
|
||||
</table></div>
|
||||
|
||||
|
||||
<h2>Embedding Printer Options</h2>
|
||||
|
||||
|
||||
<h2>Embedding Fonts and Text</h2>
|
||||
|
||||
|
||||
<h2>Embedding Images</h2>
|
||||
|
||||
|
||||
<blockquote><b>Note:</b> While some printers support arbitrary
|
||||
binary data in PostScript files, we do not recommend this
|
||||
practice because it does not work with all printers or
|
||||
interfaces. In most cases, the Base-85 encoding and compression
|
||||
filters can be used to embed images with very little, if any,
|
||||
increase in data size.</blockquote>
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -8,7 +8,7 @@
|
||||
</head>
|
||||
<body>
|
||||
<!--
|
||||
"$Id: spec-ppd.html 5217 2006-03-02 21:24:01Z mike $"
|
||||
"$Id: spec-ppd.html 5496 2006-05-05 19:26:23Z mike $"
|
||||
|
||||
CUPS PPD extensions specification for the Common UNIX Printing System (CUPS).
|
||||
|
||||
@@ -473,23 +473,20 @@ is not absolute, it is loaded relative to the
|
||||
|
||||
<h4>Customizing the Profile Selection Keywords</h4>
|
||||
|
||||
<p>The <tt>ColorModel</tt>, <tt>MediaType</tt>, and
|
||||
<tt>Resolution</tt> keywords can be reassigned to different main
|
||||
keywords, allowing drivers to do color profile selection based
|
||||
on different parameters. The <tt>cupsICCQualifier1</tt>,
|
||||
<tt>cupsICCQualifier2</tt>, and <tt>cupsICCQualifier3</tt>
|
||||
<p>The <tt>MediaType</tt> and <tt>Resolution</tt> keywords can be
|
||||
reassigned to different main keywords, allowing drivers to do
|
||||
color profile selection based on different parameters. The
|
||||
<tt>cupsICCQualifier2</tt> and <tt>cupsICCQualifier3</tt>
|
||||
attributes define the mapping from selector to main keyword:</p>
|
||||
|
||||
<pre class='command'>
|
||||
*cupsICCQualifier1: MainKeyword
|
||||
*cupsICCQualifier2: MainKeyword
|
||||
*cupsICCQualifier3: MainKeyword
|
||||
*cupsICCQualifier2: MainKeyword2
|
||||
*cupsICCQualifier3: MainKeyword3
|
||||
</pre>
|
||||
|
||||
<p>The default mapping is as follows:</p>
|
||||
|
||||
<pre class='command'>
|
||||
*cupsICCQualifier1: ColorModel
|
||||
*cupsICCQualifier2: MediaType
|
||||
*cupsICCQualifier3: Resolution
|
||||
</pre>
|
||||
|
||||
@@ -31,11 +31,14 @@ HREF="overview.html">"Overview of CUPS"</A> document instead.</P>
|
||||
SSL-encrypted, and TLS-encrypted connections over
|
||||
a single port</LI>
|
||||
|
||||
<LI><EM>Network Printer Discovery;</EM> CUPS can
|
||||
now find printers on the LAN using SNMP</LI>
|
||||
|
||||
</OL></DD>
|
||||
|
||||
|
||||
<DT>Browsing</DT>
|
||||
<DD><OL START="4">
|
||||
<DD><OL START="5">
|
||||
|
||||
<LI><EM>LDAP Support;</EM> CUPS now supports
|
||||
printer sharing via the Lightweight Directory
|
||||
@@ -76,7 +79,7 @@ HREF="overview.html">"Overview of CUPS"</A> document instead.</P>
|
||||
|
||||
|
||||
<DT>Web Interface</DT>
|
||||
<DD><OL START="11">
|
||||
<DD><OL START="12">
|
||||
|
||||
<LI><EM>Improved Look and Feel;</EM> The web
|
||||
interface has improved readability and a more
|
||||
@@ -169,7 +172,7 @@ HREF="overview.html">"Overview of CUPS"</A> document instead.</P>
|
||||
|
||||
|
||||
<DT>IPP Support</DT>
|
||||
<DD><OL START="30"></EM></LI>
|
||||
<DD><OL START="31"></EM></LI>
|
||||
|
||||
<LI><EM>IPP Notifications;</EM> CUPS now supports
|
||||
the complete IPP notification specification to
|
||||
@@ -269,7 +272,7 @@ HREF="overview.html">"Overview of CUPS"</A> document instead.</P>
|
||||
|
||||
|
||||
<DT>Scheduler</DT>
|
||||
<DD><OL START="48">
|
||||
<DD><OL START="49">
|
||||
|
||||
<LI><EM>Remote Printer Caching;</EM> The scheduler
|
||||
now maintains a remote printer cache so that
|
||||
@@ -376,7 +379,7 @@ HREF="overview.html">"Overview of CUPS"</A> document instead.</P>
|
||||
|
||||
|
||||
<DT>LPD Client Support</DT>
|
||||
<DD><OL START="68">
|
||||
<DD><OL START="69">
|
||||
|
||||
<LI><EM>Performance Improvements;</EM> CUPS no
|
||||
longer loads every available printer before
|
||||
@@ -393,7 +396,7 @@ HREF="overview.html">"Overview of CUPS"</A> document instead.</P>
|
||||
|
||||
|
||||
<DT>Localization and Internationalization</DT>
|
||||
<DD><OL START="71">
|
||||
<DD><OL START="72">
|
||||
|
||||
<LI><EM>Command-Line Programs;</EM> All
|
||||
command-line programs are now fully
|
||||
@@ -411,7 +414,7 @@ HREF="overview.html">"Overview of CUPS"</A> document instead.</P>
|
||||
|
||||
|
||||
<DT>Printer Drivers</DT>
|
||||
<DD><OL START="74">
|
||||
<DD><OL START="75">
|
||||
|
||||
<LI><EM>New Drivers;</EM> CUPS 1.2 adds Zebra
|
||||
CPCL and EPL label printer drivers</LI>
|
||||
@@ -446,7 +449,7 @@ HREF="overview.html">"Overview of CUPS"</A> document instead.</P>
|
||||
|
||||
|
||||
<DT>CUPS API</DT>
|
||||
<DD><OL START="81">
|
||||
<DD><OL START="82">
|
||||
|
||||
<LI><EM>Thread Safety;</EM> All of the CUPS API
|
||||
is now thread-safe on systems that support POSIX
|
||||
@@ -503,7 +506,7 @@ HREF="overview.html">"Overview of CUPS"</A> document instead.</P>
|
||||
|
||||
|
||||
<DT>CUPS Imaging API</DT>
|
||||
<DD><OL START="91">
|
||||
<DD><OL START="92">
|
||||
|
||||
<LI><EM>Image API;</EM> The new image API
|
||||
provides access to image files of arbitrary size
|
||||
@@ -519,7 +522,7 @@ HREF="overview.html">"Overview of CUPS"</A> document instead.</P>
|
||||
</OL></DD>
|
||||
|
||||
<DT>Scripting Support</DT>
|
||||
<DD><OL START="93">
|
||||
<DD><OL START="94">
|
||||
|
||||
<LI><EM>PHP Bindings;</EM> The PHP language
|
||||
bindings have been revamped to be more consistent
|
||||
|
||||
|
Depois Largura: | Altura: | Tamanho: 627 B |
|
Depois Largura: | Altura: | Tamanho: 536 B |
|
Depois Largura: | Altura: | Tamanho: 571 B |
|
Depois Largura: | Altura: | Tamanho: 608 B |
|
Depois Largura: | Altura: | Tamanho: 797 B |
|
Depois Largura: | Altura: | Tamanho: 531 B |
|
Depois Largura: | Altura: | Tamanho: 580 B |
|
Depois Largura: | Altura: | Tamanho: 878 B |
|
Depois Largura: | Altura: | Tamanho: 469 B |
|
Depois Largura: | Altura: | Tamanho: 339 B |
|
Depois Largura: | Altura: | Tamanho: 463 B |
|
Depois Largura: | Altura: | Tamanho: 513 B |
|
Depois Largura: | Altura: | Tamanho: 673 B |
|
Depois Largura: | Altura: | Tamanho: 657 B |