Comparar commits
1 Commits
| Autor | SHA1 | Data | |
|---|---|---|---|
| 6269f8757e |
+79
-1
@@ -1,6 +1,84 @@
|
||||
CHANGES.txt - 2010-06-17
|
||||
CHANGES.txt - 2011-01-06
|
||||
------------------------
|
||||
|
||||
CHANGES IN CUPS V1.4.6
|
||||
|
||||
- Fixed a "make check" issue on Solaris (STR #3729)
|
||||
- Regression: The pstops filter did not support landscape printing of
|
||||
PostScript files (STR #3722)
|
||||
- The scheduler killed retried (fax) jobs after restarting them
|
||||
(STR #3697)
|
||||
- The cupsAdminSetServerSettings() function disabled sharing when
|
||||
debug logging was enabled (STR #3712)
|
||||
|
||||
|
||||
CHANGES IN CUPS V1.4.5
|
||||
|
||||
- Documentation fixes (STR #3542, STR #3650)
|
||||
- Localization fixes (STR #3635, STR #3636, STR #3647, STR #3666)
|
||||
- Security: Fixed a memory corruption bug reported in CVE-2010-2941
|
||||
(STR #3648)
|
||||
- The CUPS API incorrectly mapped the HTTP_UNAUTHORIZED status to the
|
||||
IPP_NOT_AUTHORIZED status code, when IPP_NOT_AUTHENTICATED would be
|
||||
the correct mapping (STR #3684)
|
||||
- The scheduler would restart jobs while shutting down (STR #3679)
|
||||
- Fixed a PPD loader bug that could cause a crash in cupsd (STR #3680)
|
||||
- Improved the mapping of non-standard PPD and PWG names (STR #3671)
|
||||
- The scheduler did not initialize Kerberos in all cases (STR #3662)
|
||||
- cupsAdminSetServerSettings duplicated Listen and Order lines
|
||||
(STR #3645)
|
||||
- Added DeviceN colorspace support to the CUPS Raster format (STR #3419)
|
||||
- ppdMarkDefaults() did not clear the marked field of the previous
|
||||
choices (STR #3642)
|
||||
- The serial backend would not allow a raw job to be canceled
|
||||
(STR #3649)
|
||||
- The socket backend could go into an infinite loop with certain
|
||||
printers (STR #3622)
|
||||
- Setting the PRINTER or LPDEST environment variables to "name/instance"
|
||||
did not work (STR #3485)
|
||||
- The scheduler did not handle the JobRetryLimit setting properly
|
||||
(STR #3466)
|
||||
- The lpstat command always showed a remote job ID of 0 for shared
|
||||
printers (STR #3627)
|
||||
- Increased the write timeout for the libusb-based USB backend to 5
|
||||
minutes (STR #3595)
|
||||
- The libusb-base USB backend did not check whether the printer has a
|
||||
serial number (STR #3590)
|
||||
- The lpadmin command did not support setting of custom option values
|
||||
(STR #3631)
|
||||
- The lpadmin command did not support setting of the location or
|
||||
description of a class (STR #3613)
|
||||
- The cupsaddsmb command did not give up after too many failed attempts
|
||||
(STR #3615)
|
||||
- The CUPS library no longer uses certain problematic ctype macros that
|
||||
change based on the locale's character set.
|
||||
- PJL value substitution of more than 9 values was broken (STR #3621)
|
||||
- Custom options with missing string values caused ppdEmit* to segfault
|
||||
(STR #3620)
|
||||
- Fixed an issue with the Italian version of the web interface
|
||||
(STR #3624)
|
||||
- Fixed the Solaris SMF configuration file for cups-lpd (STR #3611)
|
||||
- The scheduler did not set the notify-subscribed-event attribute when
|
||||
delivering printer-added or printer-modified events (STR #3608)
|
||||
- The mailto notifier could get into an infinite loop (STR #3609)
|
||||
- Date/time information was not shown in banner pages.
|
||||
- Relational operators were broken in #if/#elif/#else/#endif expressions
|
||||
for the PPD compiler.
|
||||
- Moving a job via the web interface failed without asking for
|
||||
authentication (STR #3559)
|
||||
- The scheduler now clears the printer-state-reasons when the driver is
|
||||
changed (STR #3570)
|
||||
- The web interface did not allow a user to change the driver
|
||||
(STR #3537, STR #3601)
|
||||
- The scheduler was not setting the PATH_INFO environment variable when
|
||||
needed (STR #3600)
|
||||
- The scheduler incorrectly set the CUPSD_AUTH_TYPE environment
|
||||
variable instead of AUTH_TYPE (STR #3599)
|
||||
- Fixed a buffer overrun in the PPD compiler (STR #3594)
|
||||
- Fixed some additional IPP job template attribute mapping issues in the
|
||||
scheduler.
|
||||
|
||||
|
||||
CHANGES IN CUPS V1.4.4
|
||||
|
||||
- Documentation updates (STR #3453, STR #3527, STR #3528, STR #3529)
|
||||
|
||||
+4
-5
@@ -1,14 +1,13 @@
|
||||
INSTALL - CUPS v1.4.4 - 2010-06-17
|
||||
INSTALL - CUPS v1.4.6 - 2011-01-06
|
||||
----------------------------------
|
||||
|
||||
This file describes how to compile and install CUPS from source code. For more
|
||||
information on CUPS see the file called "README.txt". A complete change log can
|
||||
be found in "CHANGES.txt".
|
||||
|
||||
**** IF YOU HAVE A NON-POSTSCRIPT PRINTER AND ARE NOT ****
|
||||
**** RUNNING MAC OS X, YOU WILL ALSO NEED TO INSTALL GPL ****
|
||||
**** GHOSTSCRIPT WITH THE "cups" DRIVER AFTER YOU INSTALL ****
|
||||
**** CUPS. ****
|
||||
**** IF YOU HAVE A NON-POSTSCRIPT PRINTER AND ARE NOT RUNNING MAC OS X, ****
|
||||
**** YOU WILL ALSO NEED TO INSTALL GPL GHOSTSCRIPT WITH THE "cups" DRIVER ****
|
||||
**** AFTER YOU INSTALL CUPS. ****
|
||||
|
||||
|
||||
BEFORE YOU BEGIN
|
||||
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
README - CUPS v1.4.4 - 2010-06-17
|
||||
README - CUPS v1.4.6 - 2011-01-06
|
||||
---------------------------------
|
||||
|
||||
Looking for compile instructions? Read the file "INSTALL.txt"
|
||||
@@ -150,7 +150,7 @@ PRINTING FILES
|
||||
|
||||
LEGAL STUFF
|
||||
|
||||
CUPS is Copyright 2007-2010 by Apple Inc. CUPS and the CUPS logo are
|
||||
CUPS is Copyright 2007-2011 by Apple Inc. CUPS and the CUPS logo are
|
||||
trademarks of Apple Inc.
|
||||
|
||||
The MD5 Digest code is Copyright 1999 Aladdin Enterprises.
|
||||
|
||||
+4
-2
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
* "$Id$"
|
||||
*
|
||||
* Common run loop APIs for the Common UNIX Printing System (CUPS).
|
||||
* Common run loop APIs for CUPS.
|
||||
*
|
||||
* Copyright 2007-2008 by Apple Inc.
|
||||
* Copyright 2007-2010 by Apple Inc.
|
||||
* Copyright 2006-2007 by Easy Software Products, all rights reserved.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
@@ -299,6 +299,8 @@ backendRunLoop(
|
||||
strerror(errno));
|
||||
use_bc = 0;
|
||||
}
|
||||
else if (bc_bytes == 0)
|
||||
use_bc = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
+1
-1
@@ -502,7 +502,7 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
|
||||
* stdin (otherwise you can't cancel raw jobs...)
|
||||
*/
|
||||
|
||||
if (print_fd != 0)
|
||||
if (!print_fd)
|
||||
{
|
||||
#ifdef HAVE_SIGSET /* Use System V signals over POSIX to avoid bugs */
|
||||
sigset(SIGTERM, SIG_IGN);
|
||||
|
||||
+136
-8
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* "$Id$"
|
||||
*
|
||||
* Copyright 2005-2009 Apple Inc. All rights reserved.
|
||||
* Copyright 2005-2010 Apple Inc. All rights reserved.
|
||||
*
|
||||
* IMPORTANT: This Apple software is supplied to you by Apple Computer,
|
||||
* Inc. ("Apple") in consideration of your agreement to the following
|
||||
@@ -112,6 +112,12 @@ extern char **environ;
|
||||
|
||||
#define DEBUG_WRITES 0
|
||||
|
||||
/*
|
||||
* WAIT_EOF_DELAY is number of seconds we'll wait for responses from
|
||||
* the printer after we've finished sending all the data
|
||||
*/
|
||||
#define WAIT_EOF_DELAY 7
|
||||
#define WAIT_SIDE_DELAY 3
|
||||
#define DEFAULT_TIMEOUT 5000L
|
||||
|
||||
#define USB_INTERFACE_KIND CFUUIDGetUUIDBytes(kIOUSBInterfaceInterfaceID190)
|
||||
@@ -241,6 +247,11 @@ typedef struct globals_s
|
||||
Boolean wait_eof;
|
||||
int drain_output; /* Drain all pending output */
|
||||
int bidi_flag; /* 0=unidirectional, 1=bidirectional */
|
||||
|
||||
pthread_mutex_t sidechannel_thread_mutex;
|
||||
pthread_cond_t sidechannel_thread_cond;
|
||||
int sidechannel_thread_stop;
|
||||
int sidechannel_thread_done;
|
||||
} globals_t;
|
||||
|
||||
|
||||
@@ -281,8 +292,8 @@ static void status_timer_cb(CFRunLoopTimerRef timer, void *info);
|
||||
#if defined(__i386__) || defined(__x86_64__)
|
||||
static pid_t child_pid; /* Child PID */
|
||||
static void run_legacy_backend(int argc, char *argv[], int fd); /* Starts child backend process running as a ppc executable */
|
||||
static void sigterm_handler(int sig); /* SIGTERM handler */
|
||||
#endif /* __i386__ || __x86_64__ */
|
||||
static void sigterm_handler(int sig); /* SIGTERM handler */
|
||||
|
||||
#ifdef PARSE_PS_ERRORS
|
||||
static const char *next_line (const char *buffer);
|
||||
@@ -333,6 +344,7 @@ print_device(const char *uri, /* I - Device URI */
|
||||
UInt32 bytes; /* Bytes written */
|
||||
struct timeval *timeout, /* Timeout pointer */
|
||||
stimeout; /* Timeout for select() */
|
||||
struct timespec cond_timeout; /* pthread condition timeout */
|
||||
|
||||
|
||||
/*
|
||||
@@ -476,6 +488,12 @@ print_device(const char *uri, /* I - Device URI */
|
||||
|
||||
if (have_sidechannel)
|
||||
{
|
||||
g.sidechannel_thread_stop = 0;
|
||||
g.sidechannel_thread_done = 0;
|
||||
|
||||
pthread_cond_init(&g.sidechannel_thread_cond, NULL);
|
||||
pthread_mutex_init(&g.sidechannel_thread_mutex, NULL);
|
||||
|
||||
if (pthread_create(&sidechannel_thread_id, NULL, sidechannel_thread, NULL))
|
||||
{
|
||||
_cupsLangPuts(stderr, _("ERROR: Fatal USB error\n"));
|
||||
@@ -732,6 +750,104 @@ print_device(const char *uri, /* I - Device URI */
|
||||
|
||||
fprintf(stderr, "DEBUG: Sent %lld bytes...\n", (off_t)total_bytes);
|
||||
|
||||
if (!print_fd)
|
||||
{
|
||||
/*
|
||||
* Re-enable the SIGTERM handler so pthread_kill() will work...
|
||||
*/
|
||||
|
||||
struct sigaction action; /* POSIX signal action */
|
||||
|
||||
memset(&action, 0, sizeof(action));
|
||||
|
||||
sigemptyset(&action.sa_mask);
|
||||
sigaddset(&action.sa_mask, SIGTERM);
|
||||
action.sa_handler = sigterm_handler;
|
||||
sigaction(SIGTERM, &action, NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
* Wait for the side channel thread to exit...
|
||||
*/
|
||||
|
||||
if (have_sidechannel)
|
||||
{
|
||||
close(CUPS_SC_FD);
|
||||
pthread_mutex_lock(&g.readwrite_lock_mutex);
|
||||
g.readwrite_lock = 0;
|
||||
pthread_cond_signal(&g.readwrite_lock_cond);
|
||||
pthread_mutex_unlock(&g.readwrite_lock_mutex);
|
||||
|
||||
g.sidechannel_thread_stop = 1;
|
||||
pthread_mutex_lock(&g.sidechannel_thread_mutex);
|
||||
if (!g.sidechannel_thread_done)
|
||||
{
|
||||
/*
|
||||
* Wait for the side-channel thread to exit...
|
||||
*/
|
||||
|
||||
cond_timeout.tv_sec = time(NULL) + WAIT_SIDE_DELAY;
|
||||
cond_timeout.tv_nsec = 0;
|
||||
if (pthread_cond_timedwait(&g.sidechannel_thread_cond,
|
||||
&g.sidechannel_thread_mutex,
|
||||
&cond_timeout) != 0)
|
||||
{
|
||||
/*
|
||||
* Force the side-channel thread to exit...
|
||||
*/
|
||||
|
||||
fputs("DEBUG: Force the side-channel thread to exit...\n", stderr);
|
||||
pthread_kill(sidechannel_thread_id, SIGTERM);
|
||||
}
|
||||
}
|
||||
pthread_mutex_unlock(&g.sidechannel_thread_mutex);
|
||||
|
||||
pthread_join(sidechannel_thread_id, NULL);
|
||||
|
||||
pthread_cond_destroy(&g.sidechannel_thread_cond);
|
||||
pthread_mutex_destroy(&g.sidechannel_thread_mutex);
|
||||
}
|
||||
|
||||
pthread_cond_destroy(&g.readwrite_lock_cond);
|
||||
pthread_mutex_destroy(&g.readwrite_lock_mutex);
|
||||
|
||||
/*
|
||||
* Signal the read thread to stop...
|
||||
*/
|
||||
|
||||
g.read_thread_stop = 1;
|
||||
|
||||
/*
|
||||
* Give the read thread WAIT_EOF_DELAY seconds to complete all the data. If
|
||||
* we are not signaled in that time then force the thread to exit.
|
||||
*/
|
||||
|
||||
pthread_mutex_lock(&g.read_thread_mutex);
|
||||
|
||||
if (!g.read_thread_done)
|
||||
{
|
||||
cond_timeout.tv_sec = time(NULL) + WAIT_EOF_DELAY;
|
||||
cond_timeout.tv_nsec = 0;
|
||||
|
||||
if (pthread_cond_timedwait(&g.read_thread_cond, &g.read_thread_mutex,
|
||||
&cond_timeout) != 0)
|
||||
{
|
||||
/*
|
||||
* Force the read thread to exit...
|
||||
*/
|
||||
|
||||
g.wait_eof = 0;
|
||||
fputs("DEBUG: Force the read thread to exit...\n", stderr);
|
||||
pthread_kill(read_thread_id, SIGTERM);
|
||||
}
|
||||
}
|
||||
pthread_mutex_unlock(&g.read_thread_mutex);
|
||||
|
||||
pthread_join(read_thread_id, NULL); /* wait for the read thread to return */
|
||||
|
||||
pthread_cond_destroy(&g.read_thread_cond);
|
||||
pthread_mutex_destroy(&g.read_thread_mutex);
|
||||
|
||||
/*
|
||||
* Close the connection and input file and general clean up...
|
||||
*/
|
||||
@@ -940,7 +1056,12 @@ sidechannel_thread(void *reference)
|
||||
break;
|
||||
}
|
||||
}
|
||||
while (1);
|
||||
while (!g.sidechannel_thread_stop);
|
||||
|
||||
pthread_mutex_lock(&g.sidechannel_thread_mutex);
|
||||
g.sidechannel_thread_done = 1;
|
||||
pthread_cond_signal(&g.sidechannel_thread_cond);
|
||||
pthread_mutex_unlock(&g.sidechannel_thread_mutex);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
@@ -1276,7 +1397,10 @@ static kern_return_t load_classdriver(CFStringRef driverPath,
|
||||
{
|
||||
fprintf(stderr, "DEBUG: Unable to load class driver \"%s\": %s\n",
|
||||
bundlestr, strerror(errno));
|
||||
return (kr);
|
||||
if (errno == ENOENT)
|
||||
return (load_classdriver(NULL, intf, printerDriver));
|
||||
else
|
||||
return (kr);
|
||||
}
|
||||
else if (bundleinfo.st_mode & S_IWOTH)
|
||||
{
|
||||
@@ -1928,6 +2052,8 @@ static void run_legacy_backend(int argc,
|
||||
|
||||
exit(exitstatus);
|
||||
}
|
||||
#endif /* __i386__ || __x86_64__ */
|
||||
|
||||
|
||||
/*
|
||||
* 'sigterm_handler()' - SIGTERM handler.
|
||||
@@ -1936,8 +2062,11 @@ static void run_legacy_backend(int argc,
|
||||
static void
|
||||
sigterm_handler(int sig) /* I - Signal */
|
||||
{
|
||||
/* If we started a child process pass the signal on to it...
|
||||
*/
|
||||
#if defined(__i386__) || defined(__x86_64__)
|
||||
/*
|
||||
* If we started a child process pass the signal on to it...
|
||||
*/
|
||||
|
||||
if (child_pid)
|
||||
{
|
||||
/*
|
||||
@@ -1959,9 +2088,8 @@ sigterm_handler(int sig) /* I - Signal */
|
||||
exit(CUPS_BACKEND_STOP);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* __i386__ || __x86_64__ */
|
||||
}
|
||||
|
||||
|
||||
#ifdef PARSE_PS_ERRORS
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
* "$Id$"
|
||||
*
|
||||
* Libusb interface code for the Common UNIX Printing System (CUPS).
|
||||
* Libusb interface code for CUPS.
|
||||
*
|
||||
* Copyright 2007-2009 by Apple Inc.
|
||||
* Copyright 2007-2010 by Apple Inc.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
* property of Apple Inc. and are protected by Federal copyright
|
||||
@@ -172,7 +172,7 @@ print_device(const char *uri, /* I - Device URI */
|
||||
if ((bytes = read(print_fd, buffer, sizeof(buffer))) > 0)
|
||||
{
|
||||
if (usb_bulk_write(printer->handle, printer->write_endp, buffer,
|
||||
bytes, 45000) < 0)
|
||||
bytes, 3600000) < 0)
|
||||
{
|
||||
_cupsLangPrintf(stderr,
|
||||
_("ERROR: Unable to write %d bytes to printer!\n"),
|
||||
@@ -518,7 +518,8 @@ make_device_uri(
|
||||
|
||||
if ((sern = cupsGetOption("SERIALNUMBER", num_values, values)) == NULL)
|
||||
if ((sern = cupsGetOption("SERN", num_values, values)) == NULL)
|
||||
if ((sern = cupsGetOption("SN", num_values, values)) == NULL)
|
||||
if ((sern = cupsGetOption("SN", num_values, values)) == NULL &&
|
||||
printer->device->descriptor.iSerialNumber)
|
||||
{
|
||||
/*
|
||||
* Try getting the serial number from the device itself...
|
||||
|
||||
+2
-4
@@ -951,8 +951,6 @@ do_am_printer(http_t *http, /* I - HTTP connection */
|
||||
if (!cgiGetVariable("CURRENT_MAKE"))
|
||||
cgiSetVariable("CURRENT_MAKE", make);
|
||||
|
||||
cgiSetVariable("PPD_MAKE", make);
|
||||
|
||||
if (!cgiGetVariable("CURRENT_MAKE_AND_MODEL"))
|
||||
cgiSetVariable("CURRENT_MAKE_AND_MODEL", uriptr);
|
||||
|
||||
@@ -1218,8 +1216,8 @@ do_am_printer(http_t *http, /* I - HTTP connection */
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri",
|
||||
NULL, "ipp://localhost/printers/");
|
||||
|
||||
if ((var = cgiGetVariable("CURRENT_MAKE")) == NULL)
|
||||
var = cgiGetVariable("PPD_MAKE");
|
||||
if ((var = cgiGetVariable("PPD_MAKE")) == NULL)
|
||||
var = cgiGetVariable("CURRENT_MAKE");
|
||||
if (var && !cgiGetVariable("SELECT_MAKE"))
|
||||
{
|
||||
const char *make_model; /* Make and model */
|
||||
|
||||
+6
-2
@@ -285,10 +285,14 @@ cgiMoveJobs(http_t *http, /* I - Connection to server */
|
||||
|
||||
|
||||
/*
|
||||
* See who is logged in...
|
||||
* Make sure we have a username...
|
||||
*/
|
||||
|
||||
user = getenv("REMOTE_USER");
|
||||
if ((user = getenv("REMOTE_USER")) == NULL)
|
||||
{
|
||||
puts("Status: 401\n");
|
||||
exit(0);
|
||||
}
|
||||
|
||||
/*
|
||||
* See if the user has already selected a new destination...
|
||||
|
||||
@@ -46,6 +46,10 @@ DefaultAuthType Basic
|
||||
# Set the default printer/job policies...
|
||||
<Policy default>
|
||||
# Job-related operations must be done by the owner or an administrator...
|
||||
<Limit Create-Job Print-Job Print-URI Validate-Job>
|
||||
Order deny,allow
|
||||
</Limit>
|
||||
|
||||
<Limit Send-Document Send-URI Hold-Job Release-Job Restart-Job Purge-Jobs Set-Job-Attributes Create-Job-Subscription Renew-Subscription Cancel-Subscription Get-Notifications Reprocess-Job Cancel-Current-Job Suspend-Current-Job Resume-Job CUPS-Move-Job CUPS-Get-Document>
|
||||
Require user @OWNER @SYSTEM
|
||||
Order deny,allow
|
||||
@@ -79,7 +83,7 @@ DefaultAuthType Basic
|
||||
# Set the authenticated printer/job policies...
|
||||
<Policy authenticated>
|
||||
# Job-related operations must be done by the owner or an administrator...
|
||||
<Limit Create-Job Print-Job Print-URI>
|
||||
<Limit Create-Job Print-Job Print-URI Validate-Job>
|
||||
AuthType Default
|
||||
Order deny,allow
|
||||
</Limit>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
dnl
|
||||
dnl "$Id: cups-common.m4 9160 2010-06-16 20:25:12Z mike $"
|
||||
dnl "$Id: cups-common.m4 9377 2010-11-17 19:59:14Z mike $"
|
||||
dnl
|
||||
dnl Common configuration stuff for CUPS.
|
||||
dnl
|
||||
@@ -20,7 +20,7 @@ dnl Set the name of the config header file...
|
||||
AC_CONFIG_HEADER(config.h)
|
||||
|
||||
dnl Version number information...
|
||||
CUPS_VERSION="1.4.4"
|
||||
CUPS_VERSION="1.4.6"
|
||||
CUPS_REVISION=""
|
||||
#if test -z "$CUPS_REVISION" -a -d .svn; then
|
||||
# CUPS_REVISION="-r`svnversion . | awk -F: '{print $NF}' | sed -e '1,$s/[[a-zA-Z]]*//g'`"
|
||||
@@ -133,6 +133,13 @@ AC_CHECK_HEADER(sys/param.h,AC_DEFINE(HAVE_SYS_PARAM_H))
|
||||
AC_CHECK_HEADER(sys/ucred.h,AC_DEFINE(HAVE_SYS_UCRED_H))
|
||||
AC_CHECK_HEADER(scsi/sg.h,AC_DEFINE(HAVE_SCSI_SG_H))
|
||||
|
||||
dnl Checks for statfs and its many headers...
|
||||
AC_CHECK_HEADER(sys/mount.h,AC_DEFINE(HAVE_SYS_MOUNT_H))
|
||||
AC_CHECK_HEADER(sys/statfs.h,AC_DEFINE(HAVE_SYS_STATFS_H))
|
||||
AC_CHECK_HEADER(sys/statvfs.h,AC_DEFINE(HAVE_SYS_STATVFS_H))
|
||||
AC_CHECK_HEADER(sys/vfs.h,AC_DEFINE(HAVE_SYS_VFS_H))
|
||||
AC_CHECK_FUNCS(statfs statvfs)
|
||||
|
||||
dnl Checks for string functions.
|
||||
AC_CHECK_FUNCS(strdup strcasecmp strncasecmp strlcat strlcpy)
|
||||
if test "$uname" = "HP-UX" -a "$uversion" = "1020"; then
|
||||
@@ -300,6 +307,7 @@ case $uname in
|
||||
LIBS="-framework SystemConfiguration -framework CoreFoundation -framework Security $LIBS"
|
||||
|
||||
dnl Check for framework headers...
|
||||
AC_CHECK_HEADER(ApplicationServices/ApplicationServices.h,AC_DEFINE(HAVE_APPLICATIONSERVICES_H))
|
||||
AC_CHECK_HEADER(CoreFoundation/CoreFoundation.h,AC_DEFINE(HAVE_COREFOUNDATION_H))
|
||||
AC_CHECK_HEADER(CoreFoundation/CFPriv.h,AC_DEFINE(HAVE_CFPRIV_H))
|
||||
AC_CHECK_HEADER(CoreFoundation/CFBundlePriv.h,AC_DEFINE(HAVE_CFBUNDLEPRIV_H))
|
||||
@@ -362,5 +370,5 @@ AC_SUBST(FONTS)
|
||||
AC_SUBST(LEGACY_BACKENDS)
|
||||
|
||||
dnl
|
||||
dnl End of "$Id: cups-common.m4 9160 2010-06-16 20:25:12Z mike $".
|
||||
dnl End of "$Id: cups-common.m4 9377 2010-11-17 19:59:14Z mike $".
|
||||
dnl
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
dnl
|
||||
dnl "$Id: cups-ssl.m4 9165 2010-06-17 18:20:39Z mike $"
|
||||
dnl "$Id: cups-ssl.m4 9203 2010-07-14 23:58:04Z mike $"
|
||||
dnl
|
||||
dnl OpenSSL/GNUTLS stuff for CUPS.
|
||||
dnl
|
||||
@@ -38,6 +38,8 @@ if test x$enable_ssl != xno; then
|
||||
AC_DEFINE(HAVE_CDSASSL)
|
||||
|
||||
dnl Check for the various security headers...
|
||||
AC_CHECK_HEADER(Security/SecItemPriv.h,
|
||||
AC_DEFINE(HAVE_SECITEMPRIV_H))
|
||||
AC_CHECK_HEADER(Security/SecPolicy.h,
|
||||
AC_DEFINE(HAVE_SECPOLICY_H))
|
||||
AC_CHECK_HEADER(Security/SecPolicyPriv.h,
|
||||
@@ -54,6 +56,15 @@ if test x$enable_ssl != xno; then
|
||||
AC_MSG_RESULT(yes)
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
|
||||
dnl Check for SecPolicyCreateSSL...
|
||||
AC_MSG_CHECKING(for SecPolicyCreateSSL)
|
||||
if test $uversion -ge 110; then
|
||||
AC_DEFINE(HAVE_SECPOLICYCREATESSL)
|
||||
AC_MSG_RESULT(yes)
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
fi])
|
||||
fi
|
||||
fi
|
||||
@@ -143,5 +154,5 @@ AC_SUBST(EXPORT_SSLLIBS)
|
||||
|
||||
|
||||
dnl
|
||||
dnl End of "$Id: cups-ssl.m4 9165 2010-06-17 18:20:39Z mike $".
|
||||
dnl End of "$Id: cups-ssl.m4 9203 2010-07-14 23:58:04Z mike $".
|
||||
dnl
|
||||
|
||||
@@ -289,6 +289,7 @@
|
||||
*/
|
||||
|
||||
#undef HAVE_AUTHORIZATION_H
|
||||
#undef HAVE_SECITEMPRIV_H
|
||||
#undef HAVE_SECPOLICY_H
|
||||
#undef HAVE_SECPOLICYPRIV_H
|
||||
#undef HAVE_SECBASEPRIV_H
|
||||
@@ -302,6 +303,13 @@
|
||||
#undef HAVE_SECIDENTITYSEARCHCREATEWITHPOLICY
|
||||
|
||||
|
||||
/*
|
||||
* Do we have the SecPolicyCreateSSL function?
|
||||
*/
|
||||
|
||||
#undef HAVE_SECPOLICYCREATESSL
|
||||
|
||||
|
||||
/*
|
||||
* Do we have the SLP library?
|
||||
*/
|
||||
@@ -488,6 +496,13 @@
|
||||
#undef HAVE_CFBUNDLEPRIV_H
|
||||
|
||||
|
||||
/*
|
||||
* Do we have ApplicationServices public headers?
|
||||
*/
|
||||
|
||||
#undef HAVE_APPLICATIONSERVICES_H
|
||||
|
||||
|
||||
/*
|
||||
* Do we have the SCDynamicStoreCopyComputerName function?
|
||||
*/
|
||||
@@ -639,6 +654,18 @@
|
||||
#undef HAVE_TCPD_H
|
||||
|
||||
|
||||
/*
|
||||
* Do we have statfs or statvfs and one of the corresponding headers?
|
||||
*/
|
||||
|
||||
#undef HAVE_STATFS
|
||||
#undef HAVE_STATVFS
|
||||
#undef HAVE_SYS_MOUNT_H
|
||||
#undef HAVE_SYS_STATFS_H
|
||||
#undef HAVE_SYS_STATVFS_H
|
||||
#undef HAVE_SYS_VFS_H
|
||||
|
||||
|
||||
#endif /* !_CUPS_CONFIG_H_ */
|
||||
|
||||
/*
|
||||
|
||||
+1
-1
@@ -70,7 +70,7 @@ AC_OUTPUT(Makedefs packaging/cups.list init/cups.sh init/cups-lpd cups-config
|
||||
init/org.cups.cups-lpd.plist init/cups.xml
|
||||
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/drv.man man/lpoptions.man
|
||||
man/cupsd.conf.man man/lpoptions.man
|
||||
templates/header.tmpl
|
||||
$LANGFILES)
|
||||
|
||||
|
||||
+101
-73
@@ -17,16 +17,14 @@
|
||||
*
|
||||
* Contents:
|
||||
*
|
||||
* cupsAdminCreateWindowsPPD() - Create the Windows PPD file for a printer.
|
||||
* cupsAdminExportSamba() - Export a printer to Samba.
|
||||
* cupsAdminGetServerSettings() - Get settings from the server.
|
||||
* _cupsAdminGetServerSettings() - Get settings from the server (private).
|
||||
* cupsAdminSetServerSettings() - Set settings on the server.
|
||||
* _cupsAdminSetServerSettings() - Set settings on the server (private).
|
||||
* do_samba_command() - Do a SAMBA command.
|
||||
* get_cupsd_conf() - Get the current cupsd.conf file.
|
||||
* invalidate_cupsd_cache() - Invalidate the cached cupsd.conf settings.
|
||||
* write_option() - Write a CUPS option to a PPD file.
|
||||
* cupsAdminCreateWindowsPPD() - Create the Windows PPD file for a printer.
|
||||
* cupsAdminExportSamba() - Export a printer to Samba.
|
||||
* cupsAdminGetServerSettings() - Get settings from the server.
|
||||
* cupsAdminSetServerSettings() - Set settings on the server.
|
||||
* do_samba_command() - Do a SAMBA command.
|
||||
* get_cupsd_conf() - Get the current cupsd.conf file.
|
||||
* invalidate_cupsd_cache() - Invalidate the cached cupsd.conf settings.
|
||||
* write_option() - Write a CUPS option to a PPD file.
|
||||
*/
|
||||
|
||||
/*
|
||||
@@ -50,12 +48,6 @@
|
||||
* Local functions...
|
||||
*/
|
||||
|
||||
extern int _cupsAdminGetServerSettings(http_t *http,
|
||||
int *num_settings,
|
||||
cups_option_t **settings);
|
||||
extern int _cupsAdminSetServerSettings(http_t *http,
|
||||
int num_settings,
|
||||
cups_option_t *settings);
|
||||
static int do_samba_command(const char *command,
|
||||
const char *address,
|
||||
const char *subcommand,
|
||||
@@ -243,7 +235,7 @@ cupsAdminCreateWindowsPPD(
|
||||
}
|
||||
else if (jcloption && !strncmp(line, "*OrderDependency:", 17))
|
||||
{
|
||||
for (ptr = line + 17; *ptr && isspace(*ptr & 255); ptr ++);
|
||||
for (ptr = line + 17; _cups_isspace(*ptr); ptr ++);
|
||||
|
||||
ptr = strchr(ptr, ' ');
|
||||
|
||||
@@ -1024,7 +1016,7 @@ cupsAdminGetServerSettings(
|
||||
&& *value != '/'
|
||||
#endif /* AF_LOCAL */
|
||||
#ifdef AF_INET6
|
||||
&& strcmp(value, "::1")
|
||||
&& strcmp(value, "[::1]")
|
||||
#endif /* AF_INET6 */
|
||||
)
|
||||
remote_access = 1;
|
||||
@@ -1069,7 +1061,7 @@ cupsAdminGetServerSettings(
|
||||
|
||||
while (*value)
|
||||
{
|
||||
for (valptr = value; !isspace(*valptr & 255) && *valptr; valptr ++);
|
||||
for (valptr = value; *valptr && !_cups_isspace(*valptr); valptr ++);
|
||||
|
||||
if (*valptr)
|
||||
*valptr++ = '\0';
|
||||
@@ -1080,7 +1072,7 @@ cupsAdminGetServerSettings(
|
||||
break;
|
||||
}
|
||||
|
||||
for (value = valptr; isspace(*value & 255); value ++);
|
||||
for (value = valptr; _cups_isspace(*value); value ++);
|
||||
}
|
||||
}
|
||||
else if (!strcasecmp(line, "</Limit>"))
|
||||
@@ -1284,12 +1276,18 @@ cupsAdminSetServerSettings(
|
||||
else
|
||||
old_debug_logging = 0;
|
||||
|
||||
DEBUG_printf(("1cupsAdminSetServerSettings: old debug_logging=%d",
|
||||
old_debug_logging));
|
||||
|
||||
if ((val = cupsGetOption(CUPS_SERVER_REMOTE_ADMIN, cupsd_num_settings,
|
||||
cupsd_settings)) != NULL)
|
||||
old_remote_admin = atoi(val);
|
||||
else
|
||||
old_remote_admin = 0;
|
||||
|
||||
DEBUG_printf(("1cupsAdminSetServerSettings: old remote_admin=%d",
|
||||
old_remote_admin));
|
||||
|
||||
if ((val = cupsGetOption(CUPS_SERVER_REMOTE_ANY, cupsd_num_settings,
|
||||
cupsd_settings)) != NULL)
|
||||
remote_any = atoi(val);
|
||||
@@ -1305,18 +1303,27 @@ cupsAdminSetServerSettings(
|
||||
else
|
||||
old_remote_printers = 1;
|
||||
|
||||
DEBUG_printf(("1cupsAdminSetServerSettings: old remote_printers=%d",
|
||||
old_remote_printers));
|
||||
|
||||
if ((val = cupsGetOption(CUPS_SERVER_SHARE_PRINTERS, cupsd_num_settings,
|
||||
cupsd_settings)) != NULL)
|
||||
old_share_printers = atoi(val);
|
||||
else
|
||||
old_share_printers = 0;
|
||||
|
||||
DEBUG_printf(("1cupsAdminSetServerSettings: old share_printers=%d",
|
||||
old_share_printers));
|
||||
|
||||
if ((val = cupsGetOption(CUPS_SERVER_USER_CANCEL_ANY, cupsd_num_settings,
|
||||
cupsd_settings)) != NULL)
|
||||
old_user_cancel_any = atoi(val);
|
||||
else
|
||||
old_user_cancel_any = 0;
|
||||
|
||||
DEBUG_printf(("1cupsAdminSetServerSettings: old user_cancel_any=%d",
|
||||
old_user_cancel_any));
|
||||
|
||||
cupsFreeOptions(cupsd_num_settings, cupsd_settings);
|
||||
|
||||
/*
|
||||
@@ -1340,16 +1347,22 @@ cupsAdminSetServerSettings(
|
||||
else
|
||||
debug_logging = -1;
|
||||
|
||||
DEBUG_printf(("1cupsAdminSetServerSettings: debug_logging=%d",
|
||||
debug_logging));
|
||||
|
||||
if ((val = cupsGetOption(CUPS_SERVER_REMOTE_ANY, num_settings,
|
||||
settings)) != NULL)
|
||||
remote_any = atoi(val);
|
||||
|
||||
DEBUG_printf(("1cupsAdminSetServerSettings: remote_any=%d",
|
||||
remote_any));
|
||||
|
||||
if ((val = cupsGetOption(CUPS_SERVER_REMOTE_ADMIN, num_settings,
|
||||
settings)) != NULL)
|
||||
{
|
||||
remote_admin = atoi(val);
|
||||
|
||||
if (remote_admin == old_remote_admin && remote_any < 0)
|
||||
if (remote_admin == old_remote_admin)
|
||||
{
|
||||
/*
|
||||
* No change to this setting...
|
||||
@@ -1361,6 +1374,9 @@ cupsAdminSetServerSettings(
|
||||
else
|
||||
remote_admin = -1;
|
||||
|
||||
DEBUG_printf(("1cupsAdminSetServerSettings: remote_admin=%d",
|
||||
remote_admin));
|
||||
|
||||
if ((val = cupsGetOption(CUPS_SERVER_REMOTE_PRINTERS, num_settings,
|
||||
settings)) != NULL)
|
||||
{
|
||||
@@ -1378,12 +1394,15 @@ cupsAdminSetServerSettings(
|
||||
else
|
||||
remote_printers = -1;
|
||||
|
||||
DEBUG_printf(("1cupsAdminSetServerSettings: remote_printers=%d",
|
||||
remote_printers));
|
||||
|
||||
if ((val = cupsGetOption(CUPS_SERVER_SHARE_PRINTERS, num_settings,
|
||||
settings)) != NULL)
|
||||
{
|
||||
share_printers = atoi(val);
|
||||
|
||||
if (share_printers == old_share_printers && remote_any < 0)
|
||||
if (share_printers == old_share_printers)
|
||||
{
|
||||
/*
|
||||
* No change to this setting...
|
||||
@@ -1395,6 +1414,9 @@ cupsAdminSetServerSettings(
|
||||
else
|
||||
share_printers = -1;
|
||||
|
||||
DEBUG_printf(("1cupsAdminSetServerSettings: share_printers=%d",
|
||||
share_printers));
|
||||
|
||||
if ((val = cupsGetOption(CUPS_SERVER_USER_CANCEL_ANY, num_settings,
|
||||
settings)) != NULL)
|
||||
{
|
||||
@@ -1412,6 +1434,9 @@ cupsAdminSetServerSettings(
|
||||
else
|
||||
user_cancel_any = -1;
|
||||
|
||||
DEBUG_printf(("1cupsAdminSetServerSettings: user_cancel_any=%d",
|
||||
user_cancel_any));
|
||||
|
||||
/*
|
||||
* Create a temporary file for the new cupsd.conf file...
|
||||
*/
|
||||
@@ -1678,7 +1703,7 @@ cupsAdminSetServerSettings(
|
||||
remote_any > 0 ? "all" : "@LOCAL");
|
||||
}
|
||||
else if (in_root_location &&
|
||||
(remote_admin >= 0 || remote_any >= 0 || share_printers >= 0))
|
||||
(remote_admin >= 0 || remote_any > 0 || share_printers >= 0))
|
||||
{
|
||||
wrote_root_location = 1;
|
||||
|
||||
@@ -1707,83 +1732,86 @@ cupsAdminSetServerSettings(
|
||||
|
||||
cupsFilePuts(temp, "</Location>\n");
|
||||
}
|
||||
else if (!strcasecmp(line, "<Limit") && in_default_policy)
|
||||
else if (!strcasecmp(line, "<Limit"))
|
||||
{
|
||||
/*
|
||||
* See if the policy limit is for the Cancel-Job operation...
|
||||
*/
|
||||
|
||||
char *valptr; /* Pointer into value */
|
||||
|
||||
|
||||
indent += 2;
|
||||
|
||||
if (!strcasecmp(value, "cancel-job") && user_cancel_any >= 0)
|
||||
if (in_default_policy)
|
||||
{
|
||||
/*
|
||||
* Don't write anything for this limit section...
|
||||
* See if the policy limit is for the Cancel-Job operation...
|
||||
*/
|
||||
|
||||
in_cancel_job = 2;
|
||||
|
||||
char *valptr; /* Pointer into value */
|
||||
|
||||
|
||||
if (!strcasecmp(value, "cancel-job") && user_cancel_any >= 0)
|
||||
{
|
||||
/*
|
||||
* Don't write anything for this limit section...
|
||||
*/
|
||||
|
||||
in_cancel_job = 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
cupsFilePrintf(temp, "%*s%s", indent, "", line);
|
||||
|
||||
while (*value)
|
||||
{
|
||||
for (valptr = value; *valptr && !_cups_isspace(*valptr); valptr ++);
|
||||
|
||||
if (*valptr)
|
||||
*valptr++ = '\0';
|
||||
|
||||
if (!strcasecmp(value, "cancel-job") && user_cancel_any >= 0)
|
||||
{
|
||||
/*
|
||||
* Write everything except for this definition...
|
||||
*/
|
||||
|
||||
in_cancel_job = 1;
|
||||
}
|
||||
else
|
||||
cupsFilePrintf(temp, " %s", value);
|
||||
|
||||
for (value = valptr; _cups_isspace(*value); value ++);
|
||||
}
|
||||
|
||||
cupsFilePuts(temp, ">\n");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
cupsFilePrintf(temp, " %s", line);
|
||||
cupsFilePrintf(temp, "%*s%s %s>\n", indent, "", line, value);
|
||||
|
||||
while (*value)
|
||||
{
|
||||
for (valptr = value; !isspace(*valptr & 255) && *valptr; valptr ++);
|
||||
|
||||
if (*valptr)
|
||||
*valptr++ = '\0';
|
||||
|
||||
if (!strcasecmp(value, "cancel-job") && user_cancel_any >= 0)
|
||||
{
|
||||
/*
|
||||
* Write everything except for this definition...
|
||||
*/
|
||||
|
||||
in_cancel_job = 1;
|
||||
}
|
||||
else
|
||||
cupsFilePrintf(temp, " %s", value);
|
||||
|
||||
for (value = valptr; isspace(*value & 255); value ++);
|
||||
}
|
||||
|
||||
cupsFilePuts(temp, ">\n");
|
||||
}
|
||||
indent += 2;
|
||||
}
|
||||
else if (!strcasecmp(line, "</Limit>") && in_cancel_job)
|
||||
{
|
||||
indent -= 2;
|
||||
|
||||
if (in_cancel_job == 1)
|
||||
cupsFilePuts(temp, " </Limit>\n");
|
||||
cupsFilePuts(temp, " </Limit>\n");
|
||||
|
||||
wrote_policy = 1;
|
||||
|
||||
if (!user_cancel_any)
|
||||
cupsFilePuts(temp, " # Only the owner or an administrator can cancel "
|
||||
"a job...\n"
|
||||
" <Limit Cancel-Job>\n"
|
||||
" Order deny,allow\n"
|
||||
" Require user @OWNER "
|
||||
"a job...\n"
|
||||
" <Limit Cancel-Job>\n"
|
||||
" Order deny,allow\n"
|
||||
" Require user @OWNER "
|
||||
CUPS_DEFAULT_PRINTOPERATOR_AUTH "\n"
|
||||
" </Limit>\n");
|
||||
|
||||
in_cancel_job = 0;
|
||||
}
|
||||
else if ((((in_admin_location || in_conf_location || in_root_location) &&
|
||||
remote_admin >= 0) ||
|
||||
(remote_admin >= 0 || remote_any > 0)) ||
|
||||
(in_root_location && share_printers >= 0)) &&
|
||||
(!strcasecmp(line, "Allow") || !strcasecmp(line, "Deny") ||
|
||||
!strcasecmp(line, "Order")))
|
||||
continue;
|
||||
else if (in_cancel_job == 2)
|
||||
continue;
|
||||
else if (!strcasecmp(line, "<Limit") && value)
|
||||
cupsFilePrintf(temp, " %s %s>\n", line, value);
|
||||
else if (line[0] == '<')
|
||||
{
|
||||
if (value)
|
||||
@@ -1823,7 +1851,7 @@ cupsAdminSetServerSettings(
|
||||
/*
|
||||
* Record the non-policy, non-location directives that we find
|
||||
* in the server settings, since we cache this info and record it
|
||||
* in _cupsAdminGetServerSettings()...
|
||||
* in cupsAdminGetServerSettings()...
|
||||
*/
|
||||
|
||||
cupsd_num_settings = cupsAddOption(line, value, cupsd_num_settings,
|
||||
@@ -1882,7 +1910,7 @@ cupsAdminSetServerSettings(
|
||||
}
|
||||
|
||||
if (!wrote_port_listen &&
|
||||
(remote_admin >= 0 || remote_any >= 0 || share_printers >= 0))
|
||||
(remote_admin >= 0 || remote_any > 0 || share_printers >= 0))
|
||||
{
|
||||
if (remote_admin > 0 || remote_any > 0 || share_printers > 0)
|
||||
{
|
||||
@@ -1903,7 +1931,7 @@ cupsAdminSetServerSettings(
|
||||
}
|
||||
|
||||
if (!wrote_root_location &&
|
||||
(remote_admin >= 0 || remote_any >= 0 || share_printers >= 0))
|
||||
(remote_admin >= 0 || remote_any > 0 || share_printers >= 0))
|
||||
{
|
||||
if (remote_admin > 0 && share_printers > 0)
|
||||
cupsFilePuts(temp,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<!--
|
||||
"$Id: api-filter.header 8673 2009-05-22 17:34:15Z mike $"
|
||||
"$Id: api-filter.header 9272 2010-08-27 16:51:43Z mike $"
|
||||
|
||||
Filter and backend programming header for the Common UNIX Printing System
|
||||
(CUPS).
|
||||
@@ -36,7 +36,7 @@
|
||||
Programming: <a href='api-raster.html' target='_top'>Raster API</a><br>
|
||||
Programming: <a href='postscript-driver.html' target='_top'>Developing PostScript Printer Drivers</a><br>
|
||||
Programming: <a href='raster-driver.html' target='_top'>Developing Raster Printer Drivers</a><br>
|
||||
Specifications: <a href='spec-design' target='_top'>CUPS Design Description</a></td>
|
||||
Specifications: <a href='spec-design.html' target='_top'>CUPS Design Description</a></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
|
||||
+11
-9
@@ -4,7 +4,7 @@
|
||||
* PPD model-specific attribute routines for the Common UNIX Printing System
|
||||
* (CUPS).
|
||||
*
|
||||
* Copyright 2007-2009 by Apple Inc.
|
||||
* Copyright 2007-2010 by Apple Inc.
|
||||
* Copyright 1997-2006 by Easy Software Products.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
@@ -15,8 +15,10 @@
|
||||
*
|
||||
* Contents:
|
||||
*
|
||||
* ppdFindAttr() - Find the first matching attribute.
|
||||
* ppdFindNextAttr() - Find the next matching attribute.
|
||||
* ppdFindAttr() - Find the first matching attribute.
|
||||
* ppdFindNextAttr() - Find the next matching attribute.
|
||||
* _ppdGet1284Values() - Get 1284 device ID keys and values.
|
||||
* _ppdNormalizeMakeAndModel() - Normalize a product/make-and-model string.
|
||||
*/
|
||||
|
||||
/*
|
||||
@@ -178,7 +180,7 @@ _ppdGet1284Values(
|
||||
num_values = 0;
|
||||
while (*device_id)
|
||||
{
|
||||
while (isspace(*device_id & 255))
|
||||
while (_cups_isspace(*device_id))
|
||||
device_id ++;
|
||||
|
||||
if (!*device_id)
|
||||
@@ -191,13 +193,13 @@ _ppdGet1284Values(
|
||||
if (!*device_id)
|
||||
break;
|
||||
|
||||
while (ptr > key && isspace(ptr[-1] & 255))
|
||||
while (ptr > key && _cups_isspace(ptr[-1]))
|
||||
ptr --;
|
||||
|
||||
*ptr = '\0';
|
||||
device_id ++;
|
||||
|
||||
while (isspace(*device_id & 255))
|
||||
while (_cups_isspace(*device_id))
|
||||
device_id ++;
|
||||
|
||||
if (!*device_id)
|
||||
@@ -210,7 +212,7 @@ _ppdGet1284Values(
|
||||
if (!*device_id)
|
||||
break;
|
||||
|
||||
while (ptr > value && isspace(ptr[-1] & 255))
|
||||
while (ptr > value && _cups_isspace(ptr[-1]))
|
||||
ptr --;
|
||||
|
||||
*ptr = '\0';
|
||||
@@ -251,7 +253,7 @@ _ppdNormalizeMakeAndModel(
|
||||
* Skip leading whitespace...
|
||||
*/
|
||||
|
||||
while (isspace(*make_and_model & 255))
|
||||
while (_cups_isspace(*make_and_model))
|
||||
make_and_model ++;
|
||||
|
||||
/*
|
||||
@@ -406,7 +408,7 @@ _ppdNormalizeMakeAndModel(
|
||||
*/
|
||||
|
||||
for (bufptr = buffer + strlen(buffer) - 1;
|
||||
bufptr >= buffer && isspace(*bufptr & 255);
|
||||
bufptr >= buffer && _cups_isspace(*bufptr);
|
||||
bufptr --);
|
||||
|
||||
bufptr[1] = '\0';
|
||||
|
||||
+1
-1
@@ -251,7 +251,7 @@ cupsDoAuthentication(
|
||||
authorization = httpGetField(http, HTTP_FIELD_WWW_AUTHENTICATE);
|
||||
|
||||
authorization += 9;
|
||||
while (*authorization && isspace(*authorization & 255))
|
||||
while (*authorization && _cups_isspace(*authorization))
|
||||
authorization ++;
|
||||
|
||||
if (*authorization)
|
||||
|
||||
+7
-7
@@ -290,25 +290,25 @@ cupsResolveConflicts(
|
||||
|
||||
for (resval = resolver->value; *resval && !changed;)
|
||||
{
|
||||
while (isspace(*resval & 255))
|
||||
while (_cups_isspace(*resval))
|
||||
resval ++;
|
||||
|
||||
if (*resval != '*')
|
||||
break;
|
||||
|
||||
for (resval ++, resptr = resoption;
|
||||
*resval && !isspace(*resval & 255);
|
||||
*resval && !_cups_isspace(*resval);
|
||||
resval ++)
|
||||
if (resptr < (resoption + sizeof(resoption) - 1))
|
||||
*resptr++ = *resval;
|
||||
|
||||
*resptr = '\0';
|
||||
|
||||
while (isspace(*resval & 255))
|
||||
while (_cups_isspace(*resval))
|
||||
resval ++;
|
||||
|
||||
for (resptr = reschoice;
|
||||
*resval && !isspace(*resval & 255);
|
||||
*resval && !_cups_isspace(*resval);
|
||||
resval ++)
|
||||
if (resptr < (reschoice + sizeof(reschoice) - 1))
|
||||
*resptr++ = *resval;
|
||||
@@ -887,20 +887,20 @@ ppd_load_constraints(ppd_file_t *ppd) /* I - PPD file */
|
||||
* Extract "*Option Choice" or just "*Option"...
|
||||
*/
|
||||
|
||||
for (vptr ++, ptr = option; *vptr && !isspace(*vptr & 255); vptr ++)
|
||||
for (vptr ++, ptr = option; *vptr && !_cups_isspace(*vptr); vptr ++)
|
||||
if (ptr < (option + sizeof(option) - 1))
|
||||
*ptr++ = *vptr;
|
||||
|
||||
*ptr = '\0';
|
||||
|
||||
while (isspace(*vptr & 255))
|
||||
while (_cups_isspace(*vptr))
|
||||
vptr ++;
|
||||
|
||||
if (*vptr == '*')
|
||||
choice[0] = '\0';
|
||||
else
|
||||
{
|
||||
for (ptr = choice; *vptr && !isspace(*vptr & 255); vptr ++)
|
||||
for (ptr = choice; *vptr && !_cups_isspace(*vptr); vptr ++)
|
||||
if (ptr < (choice + sizeof(choice) - 1))
|
||||
*ptr++ = *vptr;
|
||||
|
||||
|
||||
+2
-2
@@ -61,10 +61,10 @@ extern "C" {
|
||||
* Constants...
|
||||
*/
|
||||
|
||||
# define CUPS_VERSION 1.0404
|
||||
# define CUPS_VERSION 1.0406
|
||||
# define CUPS_VERSION_MAJOR 1
|
||||
# define CUPS_VERSION_MINOR 4
|
||||
# define CUPS_VERSION_PATCH 4
|
||||
# define CUPS_VERSION_PATCH 6
|
||||
|
||||
# define CUPS_BC_FD 3 /* Back-channel file descriptor for select/poll */
|
||||
# define CUPS_DATE_ANY (time_t)-1
|
||||
|
||||
+15
-2
@@ -509,7 +509,19 @@ cupsGetNamedDest(http_t *http, /* I - Connection to server or @code CUPS_HTT
|
||||
set_as_default = 1;
|
||||
name = _cupsUserDefault(defname, sizeof(defname));
|
||||
|
||||
if (!name && home)
|
||||
if (name)
|
||||
{
|
||||
char *ptr; /* Temporary pointer... */
|
||||
|
||||
if ((ptr = strchr(defname, '/')) != NULL)
|
||||
{
|
||||
*ptr++ = '\0';
|
||||
instance = ptr;
|
||||
}
|
||||
else
|
||||
instance = NULL;
|
||||
}
|
||||
else if (home)
|
||||
{
|
||||
/*
|
||||
* No default in the environment, try the user's lpoptions files...
|
||||
@@ -1234,7 +1246,8 @@ appleSetDefault(const char *name) /* I - Default printer/class name */
|
||||
CFArrayRemoveValueAtIndex(newlocations, locindex);
|
||||
}
|
||||
else
|
||||
newlocations = CFArrayCreateMutable(kCFAllocatorDefault, 0, NULL);
|
||||
newlocations = CFArrayCreateMutable(kCFAllocatorDefault, 0,
|
||||
&kCFTypeArrayCallBacks);
|
||||
|
||||
newlocation = CFDictionaryCreateMutable(kCFAllocatorDefault, 0,
|
||||
&kCFTypeDictionaryKeyCallBacks,
|
||||
|
||||
+26
-14
@@ -484,7 +484,8 @@ ppdEmitJCL(ppd_file_t *ppd, /* I - PPD file record */
|
||||
*/
|
||||
|
||||
for (title += 7; *title && isdigit(*title & 255); title ++);
|
||||
for (; *title && isspace(*title & 255); title ++);
|
||||
while (_cups_isspace(*title))
|
||||
title ++;
|
||||
|
||||
if ((ptr = strstr(title, " - ")) != NULL)
|
||||
{
|
||||
@@ -683,7 +684,8 @@ ppdEmitString(ppd_file_t *ppd, /* I - PPD file record */
|
||||
case PPD_CUSTOM_PASSCODE :
|
||||
case PPD_CUSTOM_PASSWORD :
|
||||
case PPD_CUSTOM_STRING :
|
||||
bufsize += strlen(cparam->current.custom_string);
|
||||
if (cparam->current.custom_string)
|
||||
bufsize += strlen(cparam->current.custom_string);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -728,7 +730,9 @@ ppdEmitString(ppd_file_t *ppd, /* I - PPD file record */
|
||||
case PPD_CUSTOM_PASSCODE :
|
||||
case PPD_CUSTOM_PASSWORD :
|
||||
case PPD_CUSTOM_STRING :
|
||||
bufsize += 3 + 4 * strlen(cparam->current.custom_string);
|
||||
bufsize += 3;
|
||||
if (cparam->current.custom_string)
|
||||
bufsize += 4 * strlen(cparam->current.custom_string);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -797,8 +801,8 @@ ppdEmitString(ppd_file_t *ppd, /* I - PPD file record */
|
||||
*/
|
||||
|
||||
pnum = *cptr++ - '0';
|
||||
while (isalnum(*cptr & 255))
|
||||
pnum = pnum * 10 + *cptr - '0';
|
||||
while (isdigit(*cptr & 255))
|
||||
pnum = pnum * 10 + *cptr++ - '0';
|
||||
|
||||
for (cparam = (ppd_cparam_t *)cupsArrayFirst(coption->params);
|
||||
cparam;
|
||||
@@ -828,9 +832,12 @@ ppdEmitString(ppd_file_t *ppd, /* I - PPD file record */
|
||||
case PPD_CUSTOM_PASSCODE :
|
||||
case PPD_CUSTOM_PASSWORD :
|
||||
case PPD_CUSTOM_STRING :
|
||||
strlcpy(bufptr, cparam->current.custom_string,
|
||||
bufend - bufptr);
|
||||
bufptr += strlen(bufptr);
|
||||
if (cparam->current.custom_string)
|
||||
{
|
||||
strlcpy(bufptr, cparam->current.custom_string,
|
||||
bufend - bufptr);
|
||||
bufptr += strlen(bufptr);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1033,14 +1040,19 @@ ppdEmitString(ppd_file_t *ppd, /* I - PPD file record */
|
||||
case PPD_CUSTOM_STRING :
|
||||
*bufptr++ = '(';
|
||||
|
||||
for (s = cparam->current.custom_string; *s; s ++)
|
||||
if (*s < ' ' || *s == '(' || *s == ')' || *s >= 127)
|
||||
if (cparam->current.custom_string)
|
||||
{
|
||||
for (s = cparam->current.custom_string; *s; s ++)
|
||||
{
|
||||
snprintf(bufptr, bufend - bufptr + 1, "\\%03o", *s & 255);
|
||||
bufptr += strlen(bufptr);
|
||||
if (*s < ' ' || *s == '(' || *s == ')' || *s >= 127)
|
||||
{
|
||||
snprintf(bufptr, bufend - bufptr + 1, "\\%03o", *s & 255);
|
||||
bufptr += strlen(bufptr);
|
||||
}
|
||||
else
|
||||
*bufptr++ = *s;
|
||||
}
|
||||
else
|
||||
*bufptr++ = *s;
|
||||
}
|
||||
|
||||
*bufptr++ = ')';
|
||||
*bufptr++ = '\n';
|
||||
|
||||
@@ -125,6 +125,7 @@ static const _ipp_option_t ipp_options[] =
|
||||
{ 0, "penwidth", IPP_TAG_INTEGER, IPP_TAG_JOB },
|
||||
{ 0, "penwidth-default", IPP_TAG_INTEGER, IPP_TAG_PRINTER },
|
||||
{ 0, "port-monitor", IPP_TAG_NAME, IPP_TAG_PRINTER },
|
||||
{ 0, "ppd-name", IPP_TAG_NAME, IPP_TAG_PRINTER },
|
||||
{ 0, "ppi", IPP_TAG_INTEGER, IPP_TAG_JOB },
|
||||
{ 0, "ppi-default", IPP_TAG_INTEGER, IPP_TAG_PRINTER },
|
||||
{ 0, "prettyprint", IPP_TAG_BOOLEAN, IPP_TAG_JOB },
|
||||
|
||||
+5
-5
@@ -494,7 +494,7 @@ cupsFileGetConf(cups_file_t *fp, /* I - CUPS file */
|
||||
// Strip the comment and any trailing whitespace...
|
||||
while (ptr > buf)
|
||||
{
|
||||
if (!isspace(ptr[-1] & 255))
|
||||
if (!_cups_isspace(ptr[-1]))
|
||||
break;
|
||||
|
||||
ptr --;
|
||||
@@ -508,7 +508,7 @@ cupsFileGetConf(cups_file_t *fp, /* I - CUPS file */
|
||||
* Strip leading whitespace...
|
||||
*/
|
||||
|
||||
for (ptr = buf; isspace(*ptr & 255); ptr ++);
|
||||
for (ptr = buf; _cups_isspace(*ptr); ptr ++);
|
||||
|
||||
if (ptr > buf)
|
||||
_cups_strcpy(buf, ptr);
|
||||
@@ -524,7 +524,7 @@ cupsFileGetConf(cups_file_t *fp, /* I - CUPS file */
|
||||
*/
|
||||
|
||||
for (ptr = buf; *ptr; ptr ++)
|
||||
if (isspace(*ptr & 255))
|
||||
if (_cups_isspace(*ptr))
|
||||
break;
|
||||
|
||||
if (*ptr)
|
||||
@@ -533,7 +533,7 @@ cupsFileGetConf(cups_file_t *fp, /* I - CUPS file */
|
||||
* Have a value, skip any other spaces...
|
||||
*/
|
||||
|
||||
while (isspace(*ptr & 255))
|
||||
while (_cups_isspace(*ptr))
|
||||
*ptr++ = '\0';
|
||||
|
||||
if (*ptr)
|
||||
@@ -557,7 +557,7 @@ cupsFileGetConf(cups_file_t *fp, /* I - CUPS file */
|
||||
return (buf);
|
||||
}
|
||||
|
||||
while (ptr > *value && isspace(*ptr & 255))
|
||||
while (ptr > *value && _cups_isspace(*ptr))
|
||||
*ptr-- = '\0';
|
||||
}
|
||||
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
# include "http-private.h"
|
||||
# include "cups.h"
|
||||
# include "i18n.h"
|
||||
# include "ppd-private.h"
|
||||
# include "pwg-private.h"
|
||||
|
||||
# ifdef HAVE_PTHREAD_H
|
||||
|
||||
+17
-3
@@ -917,7 +917,9 @@ httpSeparateURI(
|
||||
|
||||
for (ptr = scheme, end = scheme + schemelen - 1;
|
||||
*uri && *uri != ':' && ptr < end;)
|
||||
if (isalnum(*uri & 255) || *uri == '-' || *uri == '+' || *uri == '.')
|
||||
if (strchr("ABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
||||
"abcdefghijklmnopqrstuvwxyz"
|
||||
"0123456789-+.", *uri) != NULL)
|
||||
*ptr++ = *uri++;
|
||||
else
|
||||
break;
|
||||
@@ -1353,7 +1355,8 @@ _httpResolveURI(
|
||||
DNSServiceRef ref, /* DNS-SD master service reference */
|
||||
domainref, /* DNS-SD service reference for domain */
|
||||
localref; /* DNS-SD service reference for .local */
|
||||
int domainsent = 0; /* Send the domain resolve? */
|
||||
int domainsent = 0, /* Send the domain resolve? */
|
||||
offline = 0; /* offline-report state set? */
|
||||
char *regtype, /* Pointer to type in hostname */
|
||||
*domain; /* Pointer to domain in hostname */
|
||||
_http_uribuf_t uribuf; /* URI buffer */
|
||||
@@ -1467,6 +1470,17 @@ _httpResolveURI(
|
||||
&uribuf) == kDNSServiceErr_NoError)
|
||||
domainsent = 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* If it hasn't resolved within 5 seconds set the offline-report
|
||||
* printer-state-reason...
|
||||
*/
|
||||
|
||||
if (logit && offline == 0 && time(NULL) > (start_time + 5))
|
||||
{
|
||||
fputs("STATE: +offline-report\n", stderr);
|
||||
offline = 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1494,7 +1508,7 @@ _httpResolveURI(
|
||||
else
|
||||
fputs("DEBUG: Unable to resolve URI!\n", stderr);
|
||||
|
||||
fputs("STATE: -connecting-to-device\n", stderr);
|
||||
fputs("STATE: -connecting-to-device,offline-report\n", stderr);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
+7
-7
@@ -910,7 +910,7 @@ httpGetSubField2(http_t *http, /* I - Connection to server */
|
||||
* Skip leading whitespace...
|
||||
*/
|
||||
|
||||
while (isspace(*fptr & 255))
|
||||
while (_cups_isspace(*fptr))
|
||||
fptr ++;
|
||||
|
||||
if (*fptr == ',')
|
||||
@@ -924,7 +924,7 @@ httpGetSubField2(http_t *http, /* I - Connection to server */
|
||||
*/
|
||||
|
||||
for (ptr = temp;
|
||||
*fptr && *fptr != '=' && !isspace(*fptr & 255) &&
|
||||
*fptr && *fptr != '=' && !_cups_isspace(*fptr) &&
|
||||
ptr < (temp + sizeof(temp) - 1);
|
||||
*ptr++ = *fptr++);
|
||||
|
||||
@@ -936,7 +936,7 @@ httpGetSubField2(http_t *http, /* I - Connection to server */
|
||||
* Skip trailing chars up to the '='...
|
||||
*/
|
||||
|
||||
while (isspace(*fptr & 255))
|
||||
while (_cups_isspace(*fptr))
|
||||
fptr ++;
|
||||
|
||||
if (!*fptr)
|
||||
@@ -951,7 +951,7 @@ httpGetSubField2(http_t *http, /* I - Connection to server */
|
||||
|
||||
fptr ++;
|
||||
|
||||
while (isspace(*fptr & 255))
|
||||
while (_cups_isspace(*fptr))
|
||||
fptr ++;
|
||||
|
||||
if (*fptr == '\"')
|
||||
@@ -979,12 +979,12 @@ httpGetSubField2(http_t *http, /* I - Connection to server */
|
||||
*/
|
||||
|
||||
for (ptr = value;
|
||||
*fptr && !isspace(*fptr & 255) && *fptr != ',' && ptr < end;
|
||||
*fptr && !_cups_isspace(*fptr) && *fptr != ',' && ptr < end;
|
||||
*ptr++ = *fptr++);
|
||||
|
||||
*ptr = '\0';
|
||||
|
||||
while (*fptr && !isspace(*fptr & 255) && *fptr != ',')
|
||||
while (*fptr && !_cups_isspace(*fptr) && *fptr != ',')
|
||||
fptr ++;
|
||||
}
|
||||
|
||||
@@ -2129,7 +2129,7 @@ httpUpdate(http_t *http) /* I - Connection to server */
|
||||
*/
|
||||
|
||||
*value++ = '\0';
|
||||
while (isspace(*value & 255))
|
||||
while (_cups_isspace(*value))
|
||||
value ++;
|
||||
|
||||
/*
|
||||
|
||||
+7
-3
@@ -1275,7 +1275,9 @@ ippReadIO(void *src, /* I - Data source */
|
||||
|
||||
attr->value_tag = tag;
|
||||
}
|
||||
else if ((value_tag >= IPP_TAG_TEXTLANG &&
|
||||
else if (value_tag == IPP_TAG_TEXTLANG ||
|
||||
value_tag == IPP_TAG_NAMELANG ||
|
||||
(value_tag >= IPP_TAG_TEXT &&
|
||||
value_tag <= IPP_TAG_MIMETYPE))
|
||||
{
|
||||
/*
|
||||
@@ -1283,8 +1285,9 @@ ippReadIO(void *src, /* I - Data source */
|
||||
* forms; accept sets of differing values...
|
||||
*/
|
||||
|
||||
if ((tag < IPP_TAG_TEXTLANG || tag > IPP_TAG_MIMETYPE) &&
|
||||
tag != IPP_TAG_NOVALUE)
|
||||
if (tag != IPP_TAG_TEXTLANG && tag != IPP_TAG_NAMELANG &&
|
||||
(tag < IPP_TAG_TEXT || tag > IPP_TAG_MIMETYPE) &&
|
||||
tag != IPP_TAG_NOVALUE)
|
||||
{
|
||||
DEBUG_printf(("1ippReadIO: 1setOf value tag %x(%s) != %x(%s)",
|
||||
value_tag, ippTagString(value_tag), tag,
|
||||
@@ -2766,6 +2769,7 @@ _ippFreeAttr(ipp_attribute_t *attr) /* I - Attribute to free */
|
||||
{
|
||||
case IPP_TAG_TEXT :
|
||||
case IPP_TAG_NAME :
|
||||
case IPP_TAG_RESERVED_STRING :
|
||||
case IPP_TAG_KEYWORD :
|
||||
case IPP_TAG_URI :
|
||||
case IPP_TAG_URISCHEME :
|
||||
|
||||
+2
-1
@@ -93,7 +93,8 @@ typedef enum ipp_tag_e /**** Format tags for attributes ****/
|
||||
IPP_TAG_END_COLLECTION, /* End of collection value */
|
||||
IPP_TAG_TEXT = 0x41, /* Text value */
|
||||
IPP_TAG_NAME, /* Name value */
|
||||
IPP_TAG_KEYWORD = 0x44, /* Keyword value */
|
||||
IPP_TAG_RESERVED_STRING, /* Reserved for future string value @private@ */
|
||||
IPP_TAG_KEYWORD, /* Keyword value */
|
||||
IPP_TAG_URI, /* URI value */
|
||||
IPP_TAG_URISCHEME, /* URI scheme value */
|
||||
IPP_TAG_CHARSET, /* Character set value */
|
||||
|
||||
+11
-3
@@ -267,9 +267,17 @@ _cupsEncodingName(
|
||||
{
|
||||
if (encoding < 0 ||
|
||||
encoding >= (sizeof(lang_encodings) / sizeof(const char *)))
|
||||
{
|
||||
DEBUG_printf(("1_cupsEncodingName(encoding=%d) = out of range (\"%s\")",
|
||||
encoding, lang_encodings[0]));
|
||||
return (lang_encodings[0]);
|
||||
}
|
||||
else
|
||||
{
|
||||
DEBUG_printf(("1_cupsEncodingName(encoding=%d) = \"%s\"",
|
||||
encoding, lang_encodings[encoding]));
|
||||
return (lang_encodings[encoding]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -497,7 +505,7 @@ cupsLangGet(const char *language) /* I - Language or locale */
|
||||
*/
|
||||
|
||||
for (ptr = charset, csptr ++; *csptr; csptr ++)
|
||||
if (ptr < (charset + sizeof(charset) - 1) && isalnum(*csptr & 255))
|
||||
if (ptr < (charset + sizeof(charset) - 1) && _cups_isalnum(*csptr))
|
||||
*ptr++ = *csptr;
|
||||
|
||||
*ptr = '\0';
|
||||
@@ -557,7 +565,7 @@ cupsLangGet(const char *language) /* I - Language or locale */
|
||||
*/
|
||||
|
||||
for (ptr = charset; *csptr; csptr ++)
|
||||
if (isalnum(*csptr & 255) && ptr < (charset + sizeof(charset) - 1))
|
||||
if (_cups_isalnum(*csptr) && ptr < (charset + sizeof(charset) - 1))
|
||||
*ptr++ = *csptr;
|
||||
|
||||
*ptr = '\0';
|
||||
@@ -624,7 +632,7 @@ cupsLangGet(const char *language) /* I - Language or locale */
|
||||
*/
|
||||
|
||||
for (language ++, ptr = charset; *language; language ++)
|
||||
if (isalnum(*language & 255) && ptr < (charset + sizeof(charset) - 1))
|
||||
if (_cups_isalnum(*language) && ptr < (charset + sizeof(charset) - 1))
|
||||
*ptr++ = toupper(*language & 255);
|
||||
|
||||
*ptr = '\0';
|
||||
|
||||
+10
-8
@@ -58,24 +58,26 @@ __ppdLocalizedAttr
|
||||
__ppdNormalizeMakeAndModel
|
||||
__ppdParseOptions
|
||||
__pwgCreateWithFile
|
||||
__pwgDestroy
|
||||
__pwgWriteFile
|
||||
__pwgGenerateSize
|
||||
__pwgInitSize
|
||||
__pwgMediaForLegacy
|
||||
__pwgMediaForPPD
|
||||
__pwgMediaForPWG
|
||||
__pwgMediaForSize
|
||||
__pwgCreateWithPPD
|
||||
__pwgDestroy
|
||||
__pwgGenerateSize
|
||||
__pwgGetBin
|
||||
__pwgGetInputSlot
|
||||
__pwgGetMediaType
|
||||
__pwgGetOutputBin
|
||||
__pwgGetPageSize
|
||||
__pwgGetSize
|
||||
__pwgGetSource
|
||||
__pwgGetType
|
||||
__pwgInitSize
|
||||
__pwgInputSlotForSource
|
||||
__pwgMediaForLegacy
|
||||
__pwgMediaForPPD
|
||||
__pwgMediaForPWG
|
||||
__pwgMediaForSize
|
||||
__pwgMediaTypeForType
|
||||
__pwgPageSizeForMedia
|
||||
__pwgWriteFile
|
||||
_cupsAddDest
|
||||
_cupsAddOption
|
||||
_cupsAdminCreateWindowsPPD
|
||||
|
||||
+8
-8
@@ -389,7 +389,7 @@ ppdLocalizeIPPReason(
|
||||
|
||||
valptr += 5;
|
||||
|
||||
while (*valptr && !isspace(*valptr & 255) && bufptr < bufend)
|
||||
while (*valptr && !_cups_isspace(*valptr) && bufptr < bufend)
|
||||
{
|
||||
if (*valptr == '%' && isxdigit(valptr[1] & 255) &&
|
||||
isxdigit(valptr[2] & 255))
|
||||
@@ -427,7 +427,7 @@ ppdLocalizeIPPReason(
|
||||
* Skip this URI...
|
||||
*/
|
||||
|
||||
while (*valptr && !isspace(*valptr & 255))
|
||||
while (*valptr && !_cups_isspace(*valptr))
|
||||
valptr++;
|
||||
}
|
||||
|
||||
@@ -435,7 +435,7 @@ ppdLocalizeIPPReason(
|
||||
* Skip whitespace...
|
||||
*/
|
||||
|
||||
while (isspace(*valptr & 255))
|
||||
while (_cups_isspace(*valptr))
|
||||
valptr ++;
|
||||
}
|
||||
|
||||
@@ -463,7 +463,7 @@ ppdLocalizeIPPReason(
|
||||
* Copy URI...
|
||||
*/
|
||||
|
||||
while (*valptr && !isspace(*valptr & 255) && bufptr < bufend)
|
||||
while (*valptr && !_cups_isspace(*valptr) && bufptr < bufend)
|
||||
*bufptr++ = *valptr++;
|
||||
|
||||
*bufptr = '\0';
|
||||
@@ -476,7 +476,7 @@ ppdLocalizeIPPReason(
|
||||
* Skip this URI...
|
||||
*/
|
||||
|
||||
while (*valptr && !isspace(*valptr & 255))
|
||||
while (*valptr && !_cups_isspace(*valptr))
|
||||
valptr++;
|
||||
}
|
||||
|
||||
@@ -484,7 +484,7 @@ ppdLocalizeIPPReason(
|
||||
* Skip whitespace...
|
||||
*/
|
||||
|
||||
while (isspace(*valptr & 255))
|
||||
while (_cups_isspace(*valptr))
|
||||
valptr ++;
|
||||
}
|
||||
|
||||
@@ -598,7 +598,7 @@ _ppdGetLanguages(ppd_file_t *ppd) /* I - PPD file */
|
||||
* Skip leading whitespace...
|
||||
*/
|
||||
|
||||
while (isspace(*ptr & 255))
|
||||
while (_cups_isspace(*ptr))
|
||||
ptr ++;
|
||||
|
||||
if (!*ptr)
|
||||
@@ -608,7 +608,7 @@ _ppdGetLanguages(ppd_file_t *ppd) /* I - PPD file */
|
||||
* Find the end of this language name...
|
||||
*/
|
||||
|
||||
for (start = ptr; *ptr && !isspace(*ptr & 255); ptr ++);
|
||||
for (start = ptr; *ptr && !_cups_isspace(*ptr); ptr ++);
|
||||
|
||||
if (*ptr)
|
||||
*ptr++ = '\0';
|
||||
|
||||
+30
-142
@@ -43,6 +43,7 @@
|
||||
#include "cups.h"
|
||||
#include "string.h"
|
||||
#include "debug.h"
|
||||
#include "ppd-private.h"
|
||||
#include "pwg-private.h"
|
||||
|
||||
|
||||
@@ -75,7 +76,7 @@ cupsMarkOptions(
|
||||
int num_options, /* I - Number of options */
|
||||
cups_option_t *options) /* I - Options */
|
||||
{
|
||||
int i, j, k; /* Looping vars */
|
||||
int i, j; /* Looping vars */
|
||||
char *ptr, /* Pointer into string */
|
||||
s[255]; /* Temporary string */
|
||||
const char *val, /* Pointer into value */
|
||||
@@ -83,33 +84,7 @@ cupsMarkOptions(
|
||||
*page_size, /* PageSize option */
|
||||
*ppd_keyword; /* PPD keyword */
|
||||
cups_option_t *optptr; /* Current option */
|
||||
ppd_option_t *option; /* PPD option */
|
||||
ppd_attr_t *attr; /* PPD attribute */
|
||||
static const char * const duplex_options[] =
|
||||
{ /* Duplex option names */
|
||||
"Duplex", /* Adobe */
|
||||
"EFDuplex", /* EFI */
|
||||
"EFDuplexing", /* EFI */
|
||||
"KD03Duplex", /* Kodak */
|
||||
"JCLDuplex" /* Samsung */
|
||||
};
|
||||
static const char * const duplex_one[] =
|
||||
{ /* one-sided names */
|
||||
"None",
|
||||
"False"
|
||||
};
|
||||
static const char * const duplex_two_long[] =
|
||||
{ /* two-sided-long-edge names */
|
||||
"DuplexNoTumble", /* Adobe */
|
||||
"LongEdge", /* EFI */
|
||||
"Top" /* EFI */
|
||||
};
|
||||
static const char * const duplex_two_short[] =
|
||||
{ /* two-sided-long-edge names */
|
||||
"DuplexTumble", /* Adobe */
|
||||
"ShortEdge", /* EFI */
|
||||
"Bottom" /* EFI */
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
@@ -188,98 +163,11 @@ cupsMarkOptions(
|
||||
*/
|
||||
|
||||
for (i = num_options, optptr = options; i > 0; i --, optptr ++)
|
||||
if (!strcasecmp(optptr->name, "media"))
|
||||
if (!strcasecmp(optptr->name, "media") ||
|
||||
!strcasecmp(optptr->name, "output-bin") ||
|
||||
!strcasecmp(optptr->name, "output-mode") ||
|
||||
!strcasecmp(optptr->name, "sides"))
|
||||
continue;
|
||||
else if (!strcasecmp(optptr->name, "sides"))
|
||||
{
|
||||
for (j = 0;
|
||||
j < (int)(sizeof(duplex_options) / sizeof(duplex_options[0]));
|
||||
j ++)
|
||||
if (cupsGetOption(duplex_options[j], num_options, options))
|
||||
break;
|
||||
|
||||
if (j < (int)(sizeof(duplex_options) / sizeof(duplex_options[0])))
|
||||
{
|
||||
/*
|
||||
* Don't override the PPD option with the IPP attribute...
|
||||
*/
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!strcasecmp(optptr->value, "one-sided"))
|
||||
{
|
||||
/*
|
||||
* Mark the appropriate duplex option for one-sided output...
|
||||
*/
|
||||
|
||||
for (j = 0;
|
||||
j < (int)(sizeof(duplex_options) / sizeof(duplex_options[0]));
|
||||
j ++)
|
||||
if ((option = ppdFindOption(ppd, duplex_options[j])) != NULL)
|
||||
break;
|
||||
|
||||
if (j < (int)(sizeof(duplex_options) / sizeof(duplex_options[0])))
|
||||
{
|
||||
for (k = 0;
|
||||
k < (int)(sizeof(duplex_one) / sizeof(duplex_one[0]));
|
||||
k ++)
|
||||
if (ppdFindChoice(option, duplex_one[k]))
|
||||
{
|
||||
ppd_mark_option(ppd, duplex_options[j], duplex_one[k]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (!strcasecmp(optptr->value, "two-sided-long-edge"))
|
||||
{
|
||||
/*
|
||||
* Mark the appropriate duplex option for two-sided-long-edge output...
|
||||
*/
|
||||
|
||||
for (j = 0;
|
||||
j < (int)(sizeof(duplex_options) / sizeof(duplex_options[0]));
|
||||
j ++)
|
||||
if ((option = ppdFindOption(ppd, duplex_options[j])) != NULL)
|
||||
break;
|
||||
|
||||
if (j < (int)(sizeof(duplex_options) / sizeof(duplex_options[0])))
|
||||
{
|
||||
for (k = 0;
|
||||
k < (int)(sizeof(duplex_two_long) / sizeof(duplex_two_long[0]));
|
||||
k ++)
|
||||
if (ppdFindChoice(option, duplex_two_long[k]))
|
||||
{
|
||||
ppd_mark_option(ppd, duplex_options[j], duplex_two_long[k]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (!strcasecmp(optptr->value, "two-sided-short-edge"))
|
||||
{
|
||||
/*
|
||||
* Mark the appropriate duplex option for two-sided-short-edge output...
|
||||
*/
|
||||
|
||||
for (j = 0;
|
||||
j < (int)(sizeof(duplex_options) / sizeof(duplex_options[0]));
|
||||
j ++)
|
||||
if ((option = ppdFindOption(ppd, duplex_options[j])) != NULL)
|
||||
break;
|
||||
|
||||
if (j < (int)(sizeof(duplex_options) / sizeof(duplex_options[0])))
|
||||
{
|
||||
for (k = 0;
|
||||
k < (int)(sizeof(duplex_two_short) / sizeof(duplex_two_short[0]));
|
||||
k ++)
|
||||
if (ppdFindChoice(option, duplex_two_short[k]))
|
||||
{
|
||||
ppd_mark_option(ppd, duplex_options[j], duplex_two_short[k]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (!strcasecmp(optptr->name, "resolution") ||
|
||||
!strcasecmp(optptr->name, "printer-resolution"))
|
||||
{
|
||||
@@ -291,13 +179,6 @@ cupsMarkOptions(
|
||||
ppd_mark_option(ppd, "CNRes_PGP", optptr->value);
|
||||
/* Canon */
|
||||
}
|
||||
else if (!strcasecmp(optptr->name, "output-bin"))
|
||||
{
|
||||
if (!cupsGetOption("OutputBin", num_options, options) &&
|
||||
(ppd_keyword = _pwgGetOutputBin((_pwg_t *)ppd->pwg,
|
||||
optptr->value)) != NULL)
|
||||
ppd_mark_option(ppd, "OutputBin", ppd_keyword);
|
||||
}
|
||||
else if (!strcasecmp(optptr->name, "multiple-document-handling"))
|
||||
{
|
||||
if (!cupsGetOption("Collate", num_options, options) &&
|
||||
@@ -584,7 +465,10 @@ ppdMarkDefaults(ppd_file_t *ppd) /* I - PPD file record */
|
||||
for (c = (ppd_choice_t *)cupsArrayFirst(ppd->marked);
|
||||
c;
|
||||
c = (ppd_choice_t *)cupsArrayNext(ppd->marked))
|
||||
{
|
||||
cupsArrayRemove(ppd->marked, c);
|
||||
c->marked = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Then repopulate it with the defaults...
|
||||
@@ -671,6 +555,7 @@ ppdNextOption(ppd_file_t *ppd) /* I - PPD file */
|
||||
* This function looks for strings of the form:
|
||||
*
|
||||
* *option choice ... *optionN choiceN
|
||||
* property value ... propertyN valueN
|
||||
*
|
||||
* It stops when it finds a string that doesn't match this format.
|
||||
*/
|
||||
@@ -679,10 +564,11 @@ int /* O - Number of options */
|
||||
_ppdParseOptions(
|
||||
const char *s, /* I - String to parse */
|
||||
int num_options, /* I - Number of options */
|
||||
cups_option_t **options) /* IO - Options */
|
||||
cups_option_t **options, /* IO - Options */
|
||||
_ppd_parse_t which) /* I - What to parse */
|
||||
{
|
||||
char option[PPD_MAX_NAME], /* Current option */
|
||||
choice[PPD_MAX_NAME], /* Current choice */
|
||||
char option[PPD_MAX_NAME * 2 + 1], /* Current option/property */
|
||||
choice[PPD_MAX_NAME], /* Current choice/value */
|
||||
*ptr; /* Pointer into option or choice */
|
||||
|
||||
|
||||
@@ -690,8 +576,8 @@ _ppdParseOptions(
|
||||
return (num_options);
|
||||
|
||||
/*
|
||||
* Read all of the "*Option Choice" pairs from the string, marking PPD
|
||||
* options as we go...
|
||||
* Read all of the "*Option Choice" and "property value" pairs from the
|
||||
* string, add them to an options array as we go...
|
||||
*/
|
||||
|
||||
while (*s)
|
||||
@@ -700,22 +586,18 @@ _ppdParseOptions(
|
||||
* Skip leading whitespace...
|
||||
*/
|
||||
|
||||
while (isspace(*s & 255))
|
||||
while (_cups_isspace(*s))
|
||||
s ++;
|
||||
|
||||
if (*s != '*')
|
||||
break;
|
||||
|
||||
/*
|
||||
* Get the option name...
|
||||
* Get the option/property name...
|
||||
*/
|
||||
|
||||
s ++;
|
||||
ptr = option;
|
||||
while (*s && !isspace(*s & 255) && ptr < (option + sizeof(option) - 1))
|
||||
while (*s && !_cups_isspace(*s) && ptr < (option + sizeof(option) - 1))
|
||||
*ptr++ = *s++;
|
||||
|
||||
if (ptr == s)
|
||||
if (ptr == s || !_cups_isspace(*s))
|
||||
break;
|
||||
|
||||
*ptr = '\0';
|
||||
@@ -724,23 +606,29 @@ _ppdParseOptions(
|
||||
* Get the choice...
|
||||
*/
|
||||
|
||||
while (isspace(*s & 255))
|
||||
while (_cups_isspace(*s))
|
||||
s ++;
|
||||
|
||||
if (!*s)
|
||||
break;
|
||||
|
||||
ptr = choice;
|
||||
while (*s && !isspace(*s & 255) && ptr < (choice + sizeof(choice) - 1))
|
||||
while (*s && !_cups_isspace(*s) && ptr < (choice + sizeof(choice) - 1))
|
||||
*ptr++ = *s++;
|
||||
|
||||
if (*s && !_cups_isspace(*s))
|
||||
break;
|
||||
|
||||
*ptr = '\0';
|
||||
|
||||
/*
|
||||
* Add it to the options array...
|
||||
*/
|
||||
|
||||
num_options = cupsAddOption(option, choice, num_options, options);
|
||||
if (option[0] == '*' && which != _PPD_PARSE_PROPERTIES)
|
||||
num_options = cupsAddOption(option + 1, choice, num_options, options);
|
||||
else if (option[0] != '*' && which != _PPD_PARSE_OPTIONS)
|
||||
num_options = cupsAddOption(option, choice, num_options, options);
|
||||
}
|
||||
|
||||
return (num_options);
|
||||
@@ -809,7 +697,7 @@ ppd_mark_choices(ppd_file_t *ppd, /* I - PPD file */
|
||||
return;
|
||||
|
||||
options = NULL;
|
||||
num_options = _ppdParseOptions(s, 0, &options);
|
||||
num_options = _ppdParseOptions(s, 0, &options, 0);
|
||||
|
||||
for (i = num_options, option = options; i > 0; i --, option ++)
|
||||
ppd_mark_option(ppd, option->name, option->value);
|
||||
|
||||
+6
-6
@@ -282,7 +282,7 @@ cupsParseOptions(
|
||||
* Skip leading spaces...
|
||||
*/
|
||||
|
||||
while (isspace(*ptr & 255))
|
||||
while (_cups_isspace(*ptr))
|
||||
ptr ++;
|
||||
|
||||
/*
|
||||
@@ -296,7 +296,7 @@ cupsParseOptions(
|
||||
*/
|
||||
|
||||
name = ptr;
|
||||
while (!isspace(*ptr & 255) && *ptr != '=' && *ptr)
|
||||
while (!strchr("\f\n\r\t\v =", *ptr) && *ptr)
|
||||
ptr ++;
|
||||
|
||||
/*
|
||||
@@ -310,7 +310,7 @@ cupsParseOptions(
|
||||
* Skip trailing spaces...
|
||||
*/
|
||||
|
||||
while (isspace(*ptr & 255))
|
||||
while (_cups_isspace(*ptr))
|
||||
*ptr++ = '\0';
|
||||
|
||||
if ((sep = *ptr) == '=')
|
||||
@@ -339,7 +339,7 @@ cupsParseOptions(
|
||||
|
||||
value = ptr;
|
||||
|
||||
while (*ptr && !isspace(*ptr & 255))
|
||||
while (*ptr && !_cups_isspace(*ptr))
|
||||
{
|
||||
if (*ptr == ',')
|
||||
ptr ++;
|
||||
@@ -394,7 +394,7 @@ cupsParseOptions(
|
||||
* Normal space-delimited string...
|
||||
*/
|
||||
|
||||
while (!isspace(*ptr & 255) && *ptr)
|
||||
while (*ptr && !_cups_isspace(*ptr))
|
||||
{
|
||||
if (*ptr == '\\' && ptr[1])
|
||||
_cups_strcpy(ptr, ptr + 1);
|
||||
@@ -413,7 +413,7 @@ cupsParseOptions(
|
||||
* Skip trailing whitespace...
|
||||
*/
|
||||
|
||||
while (isspace(*ptr & 255))
|
||||
while (_cups_isspace(*ptr))
|
||||
ptr ++;
|
||||
|
||||
/*
|
||||
|
||||
+10
-2
@@ -44,9 +44,16 @@ extern "C" {
|
||||
|
||||
|
||||
/*
|
||||
* Structures...
|
||||
* Types and structures...
|
||||
*/
|
||||
|
||||
typedef enum _ppd_parse_e /**** Selector for _ppdParseOptions ****/
|
||||
{
|
||||
_PPD_PARSE_OPTIONS, /* Parse only the options */
|
||||
_PPD_PARSE_PROPERTIES, /* Parse only the properties */
|
||||
_PPD_PARSE_ALL /* Parse everything */
|
||||
} _ppd_parse_t;
|
||||
|
||||
typedef struct _ppd_cups_uiconst_s /**** Constraint from cupsUIConstraints ****/
|
||||
{
|
||||
ppd_option_t *option; /* Constrained option */
|
||||
@@ -79,7 +86,8 @@ extern char *_ppdNormalizeMakeAndModel(const char *make_and_model,
|
||||
char *buffer,
|
||||
size_t bufsize);
|
||||
extern int _ppdParseOptions(const char *s, int num_options,
|
||||
cups_option_t **options);
|
||||
cups_option_t **options,
|
||||
_ppd_parse_t which);
|
||||
|
||||
|
||||
/*
|
||||
|
||||
+16
-14
@@ -666,6 +666,8 @@ ppdOpen2(cups_file_t *fp) /* I - File to read from */
|
||||
|
||||
goto error;
|
||||
}
|
||||
else if (!string)
|
||||
continue;
|
||||
|
||||
/*
|
||||
* Certain main keywords (as defined by the PPD spec) may be used
|
||||
@@ -1258,7 +1260,7 @@ ppdOpen2(cups_file_t *fp) /* I - File to read from */
|
||||
if (name[0] == '*')
|
||||
_cups_strcpy(name, name + 1); /* Eliminate leading asterisk */
|
||||
|
||||
for (i = (int)strlen(name) - 1; i > 0 && isspace(name[i] & 255); i --)
|
||||
for (i = (int)strlen(name) - 1; i > 0 && _cups_isspace(name[i]); i --)
|
||||
name[i] = '\0'; /* Eliminate trailing spaces */
|
||||
|
||||
DEBUG_printf(("2ppdOpen2: OpenUI of %s in group %s...", name,
|
||||
@@ -2358,7 +2360,7 @@ ppd_decode(char *string) /* I - String to decode */
|
||||
inptr ++;
|
||||
while (isxdigit(*inptr & 255))
|
||||
{
|
||||
if (isalpha(*inptr))
|
||||
if (_cups_isalpha(*inptr))
|
||||
*outptr = (tolower(*inptr) - 'a' + 10) << 4;
|
||||
else
|
||||
*outptr = (*inptr - '0') << 4;
|
||||
@@ -2368,7 +2370,7 @@ ppd_decode(char *string) /* I - String to decode */
|
||||
if (!isxdigit(*inptr & 255))
|
||||
break;
|
||||
|
||||
if (isalpha(*inptr))
|
||||
if (_cups_isalpha(*inptr))
|
||||
*outptr |= tolower(*inptr) - 'a' + 10;
|
||||
else
|
||||
*outptr |= *inptr - '0';
|
||||
@@ -2999,7 +3001,7 @@ ppd_read(cups_file_t *fp, /* I - File to read from */
|
||||
*/
|
||||
|
||||
for (lineptr = line->buffer; *lineptr; lineptr ++)
|
||||
if (!isspace(*lineptr & 255))
|
||||
if (*lineptr && !_cups_isspace(*lineptr))
|
||||
break;
|
||||
|
||||
if (*lineptr)
|
||||
@@ -3019,7 +3021,7 @@ ppd_read(cups_file_t *fp, /* I - File to read from */
|
||||
|
||||
keyptr = keyword;
|
||||
|
||||
while (*lineptr != '\0' && *lineptr != ':' && !isspace(*lineptr & 255))
|
||||
while (*lineptr && *lineptr != ':' && !_cups_isspace(*lineptr))
|
||||
{
|
||||
if (*lineptr <= ' ' || *lineptr > 126 || *lineptr == '/' ||
|
||||
(keyptr - keyword) >= (PPD_MAX_NAME - 1))
|
||||
@@ -3038,18 +3040,18 @@ ppd_read(cups_file_t *fp, /* I - File to read from */
|
||||
|
||||
mask |= PPD_KEYWORD;
|
||||
|
||||
if (isspace(*lineptr & 255))
|
||||
if (_cups_isspace(*lineptr))
|
||||
{
|
||||
/*
|
||||
* Get an option name...
|
||||
*/
|
||||
|
||||
while (isspace(*lineptr & 255))
|
||||
while (_cups_isspace(*lineptr))
|
||||
lineptr ++;
|
||||
|
||||
optptr = option;
|
||||
|
||||
while (*lineptr != '\0' && !isspace(*lineptr & 255) && *lineptr != ':' &&
|
||||
while (*lineptr && !_cups_isspace(*lineptr) && *lineptr != ':' &&
|
||||
*lineptr != '/')
|
||||
{
|
||||
if (*lineptr <= ' ' || *lineptr > 126 ||
|
||||
@@ -3064,13 +3066,13 @@ ppd_read(cups_file_t *fp, /* I - File to read from */
|
||||
|
||||
*optptr = '\0';
|
||||
|
||||
if (isspace(*lineptr & 255) && cg->ppd_conform == PPD_CONFORM_STRICT)
|
||||
if (_cups_isspace(*lineptr) && cg->ppd_conform == PPD_CONFORM_STRICT)
|
||||
{
|
||||
cg->ppd_status = PPD_ILLEGAL_WHITESPACE;
|
||||
return (0);
|
||||
}
|
||||
|
||||
while (isspace(*lineptr & 255))
|
||||
while (_cups_isspace(*lineptr))
|
||||
lineptr ++;
|
||||
|
||||
mask |= PPD_OPTION;
|
||||
@@ -3110,13 +3112,13 @@ ppd_read(cups_file_t *fp, /* I - File to read from */
|
||||
}
|
||||
}
|
||||
|
||||
if (isspace(*lineptr & 255) && cg->ppd_conform == PPD_CONFORM_STRICT)
|
||||
if (_cups_isspace(*lineptr) && cg->ppd_conform == PPD_CONFORM_STRICT)
|
||||
{
|
||||
cg->ppd_status = PPD_ILLEGAL_WHITESPACE;
|
||||
return (0);
|
||||
}
|
||||
|
||||
while (isspace(*lineptr & 255))
|
||||
while (_cups_isspace(*lineptr))
|
||||
lineptr ++;
|
||||
|
||||
if (*lineptr == ':')
|
||||
@@ -3126,11 +3128,11 @@ ppd_read(cups_file_t *fp, /* I - File to read from */
|
||||
*/
|
||||
|
||||
lineptr ++;
|
||||
while (isspace(*lineptr & 255))
|
||||
while (_cups_isspace(*lineptr))
|
||||
lineptr ++;
|
||||
|
||||
strptr = lineptr + strlen(lineptr) - 1;
|
||||
while (strptr >= lineptr && isspace(*strptr & 255))
|
||||
while (strptr >= lineptr && _cups_isspace(*strptr))
|
||||
*strptr-- = '\0';
|
||||
|
||||
if (*strptr == '\"')
|
||||
|
||||
+80
-2
@@ -47,11 +47,14 @@ _pwgCreateWithFile(const char *filename)/* I - File to read */
|
||||
num_sizes, /* Number of sizes in file */
|
||||
num_sources, /* Number of sources in file */
|
||||
num_types; /* Number of types in file */
|
||||
char line[512], /* Current line */
|
||||
char line[2048], /* Current line */
|
||||
*value, /* Pointer to value in line */
|
||||
*valueptr, /* Pointer into value */
|
||||
pwg_keyword[128], /* PWG keyword */
|
||||
ppd_keyword[PPD_MAX_NAME];
|
||||
/* PPD keyword */
|
||||
_pwg_output_mode_t output_mode; /* Output mode for preset */
|
||||
_pwg_print_quality_t print_quality; /* Print quality for preset */
|
||||
|
||||
|
||||
DEBUG_printf(("_pwgCreateWithFile(filename=\"%s\")", filename));
|
||||
@@ -236,6 +239,10 @@ _pwgCreateWithFile(const char *filename)/* I - File to read */
|
||||
pwg->custom_min_width, pwg->custom_min_length);
|
||||
pwg->custom_min_keyword = _cupsStrAlloc(pwg_keyword);
|
||||
}
|
||||
else if (!strcasecmp(line, "SourceOption"))
|
||||
{
|
||||
pwg->source_option = _cupsStrAlloc(value);
|
||||
}
|
||||
else if (!strcasecmp(line, "NumSources"))
|
||||
{
|
||||
if (num_sources > 0)
|
||||
@@ -332,6 +339,38 @@ _pwgCreateWithFile(const char *filename)/* I - File to read */
|
||||
|
||||
pwg->num_types ++;
|
||||
}
|
||||
else if (!strcasecmp(line, "Preset"))
|
||||
{
|
||||
/*
|
||||
* Preset output-mode print-quality name=value ...
|
||||
*/
|
||||
|
||||
output_mode = (_pwg_output_mode_t)strtol(value, &valueptr, 10);
|
||||
print_quality = (_pwg_print_quality_t)strtol(valueptr, &valueptr, 10);
|
||||
|
||||
if (output_mode < _PWG_OUTPUT_MODE_MONOCHROME ||
|
||||
output_mode >= _PWG_OUTPUT_MODE_MAX ||
|
||||
print_quality < _PWG_PRINT_QUALITY_DRAFT ||
|
||||
print_quality >= _PWG_PRINT_QUALITY_MAX ||
|
||||
valueptr == value || !*valueptr)
|
||||
{
|
||||
DEBUG_printf(("_pwgCreateWithFile: Bad Preset on line %d.", linenum));
|
||||
_cupsSetError(IPP_INTERNAL_ERROR, _("Bad PWG mapping file."), 1);
|
||||
goto create_error;
|
||||
}
|
||||
|
||||
pwg->num_presets[output_mode][print_quality] =
|
||||
cupsParseOptions(valueptr, 0,
|
||||
pwg->presets[output_mode] + print_quality);
|
||||
}
|
||||
else if (!strcasecmp(line, "SidesOption"))
|
||||
pwg->sides_option = _cupsStrAlloc(value);
|
||||
else if (!strcasecmp(line, "Sides1Sided"))
|
||||
pwg->sides_1sided = _cupsStrAlloc(value);
|
||||
else if (!strcasecmp(line, "Sides2SidedLong"))
|
||||
pwg->sides_2sided_long = _cupsStrAlloc(value);
|
||||
else if (!strcasecmp(line, "Sides2SidedShort"))
|
||||
pwg->sides_2sided_short = _cupsStrAlloc(value);
|
||||
else
|
||||
{
|
||||
DEBUG_printf(("_pwgCreateWithFile: Unknown %s on line %d.", line,
|
||||
@@ -427,6 +466,9 @@ _pwgDestroy(_pwg_t *pwg) /* I - PWG mapping data */
|
||||
free(pwg->sizes);
|
||||
}
|
||||
|
||||
if (pwg->source_option)
|
||||
_cupsStrFree(pwg->source_option);
|
||||
|
||||
if (pwg->sources)
|
||||
{
|
||||
for (i = pwg->num_sources, map = pwg->sources; i > 0; i --, map ++)
|
||||
@@ -467,10 +509,11 @@ int /* O - 1 on success, 0 on failure */
|
||||
_pwgWriteFile(_pwg_t *pwg, /* I - PWG mapping data */
|
||||
const char *filename) /* I - File to write */
|
||||
{
|
||||
int i; /* Looping var */
|
||||
int i, j, k; /* Looping vars */
|
||||
cups_file_t *fp; /* Output file */
|
||||
_pwg_size_t *size; /* Current size */
|
||||
_pwg_map_t *map; /* Current map */
|
||||
cups_option_t *option; /* Current option */
|
||||
|
||||
|
||||
/*
|
||||
@@ -530,6 +573,9 @@ _pwgWriteFile(_pwg_t *pwg, /* I - PWG mapping data */
|
||||
* Media sources...
|
||||
*/
|
||||
|
||||
if (pwg->source_option)
|
||||
cupsFilePrintf(fp, "SourceOption %s\n", pwg->source_option);
|
||||
|
||||
if (pwg->num_sources > 0)
|
||||
{
|
||||
cupsFilePrintf(fp, "NumSources %d\n", pwg->num_sources);
|
||||
@@ -548,6 +594,38 @@ _pwgWriteFile(_pwg_t *pwg, /* I - PWG mapping data */
|
||||
cupsFilePrintf(fp, "Type %s %s\n", map->pwg, map->ppd);
|
||||
}
|
||||
|
||||
/*
|
||||
* Presets...
|
||||
*/
|
||||
|
||||
for (i = _PWG_OUTPUT_MODE_MONOCHROME; i < _PWG_OUTPUT_MODE_MAX; i ++)
|
||||
for (j = _PWG_PRINT_QUALITY_DRAFT; j < _PWG_PRINT_QUALITY_MAX; j ++)
|
||||
if (pwg->num_presets[i][j])
|
||||
{
|
||||
cupsFilePrintf(fp, "Preset %d %d", i, j);
|
||||
for (k = pwg->num_presets[i][j], option = pwg->presets[i][j];
|
||||
k > 0;
|
||||
k --, option ++)
|
||||
cupsFilePrintf(fp, " %s=%s", option->name, option->value);
|
||||
cupsFilePutChar(fp, '\n');
|
||||
}
|
||||
|
||||
/*
|
||||
* Duplex/sides...
|
||||
*/
|
||||
|
||||
if (pwg->sides_option)
|
||||
cupsFilePrintf(fp, "SidesOption %s\n", pwg->sides_option);
|
||||
|
||||
if (pwg->sides_1sided)
|
||||
cupsFilePrintf(fp, "Sides1Sided %s\n", pwg->sides_1sided);
|
||||
|
||||
if (pwg->sides_2sided_long)
|
||||
cupsFilePrintf(fp, "Sides2SidedLong %s\n", pwg->sides_2sided_long);
|
||||
|
||||
if (pwg->sides_2sided_short)
|
||||
cupsFilePrintf(fp, "Sides2SidedShort %s\n", pwg->sides_2sided_short);
|
||||
|
||||
/*
|
||||
* Close and return...
|
||||
*/
|
||||
|
||||
+189
-26
@@ -61,26 +61,26 @@ static int pwg_compare_ppd(_pwg_media_t *a, _pwg_media_t *b);
|
||||
static _pwg_media_t const cups_pwg_media[] =
|
||||
{ /* Media size lookup table */
|
||||
/* North American Standard Sheet Media Sizes */
|
||||
_PWG_MEDIA_IN("na_index-3x5_3x5in", NULL, NULL, 3, 5),
|
||||
_PWG_MEDIA_IN("na_index-3x5_3x5in", NULL, "3x5", 3, 5),
|
||||
_PWG_MEDIA_IN("na_personal_3.625x6.5in", NULL, "EnvPersonal", 3.625, 6.5),
|
||||
_PWG_MEDIA_IN("na_monarch_3.875x7.5in", "monarch-envelope", "EnvMonarch", 3.875, 7.5),
|
||||
_PWG_MEDIA_IN("na_number-9_3.875x8.875in", "na-number-9-envelope", "Env9", 3.875, 8.875),
|
||||
_PWG_MEDIA_IN("na_index-4x6_4x6in", NULL, NULL, 4, 6),
|
||||
_PWG_MEDIA_IN("na_index-4x6_4x6in", NULL, "4x6", 4, 6),
|
||||
_PWG_MEDIA_IN("na_number-10_4.125x9.5in", "na-number-10-envelope", "Env10", 4.125, 9.5),
|
||||
_PWG_MEDIA_IN("na_a2_4.375x5.75in", NULL, NULL, 4.375, 5.75),
|
||||
_PWG_MEDIA_IN("na_number-11_4.5x10.375in", NULL, "Env11", 4.5, 10.375),
|
||||
_PWG_MEDIA_IN("na_number-12_4.75x11in", NULL, "Env12", 4.75, 11),
|
||||
_PWG_MEDIA_IN("na_5x7_5x7in", NULL, NULL, 5, 7),
|
||||
_PWG_MEDIA_IN("na_index-5x8_5x8in", NULL, NULL, 5, 8),
|
||||
_PWG_MEDIA_IN("na_5x7_5x7in", NULL, "5x7", 5, 7),
|
||||
_PWG_MEDIA_IN("na_index-5x8_5x8in", NULL, "5x8", 5, 8),
|
||||
_PWG_MEDIA_IN("na_number-14_5x11.5in", NULL, "Env14", 5, 11.5),
|
||||
_PWG_MEDIA_IN("na_invoice_5.5x8.5in", "invoice", "Statement", 5.5, 8.5),
|
||||
_PWG_MEDIA_IN("na_index-4x6-ext_6x8in", NULL, NULL, 6, 8),
|
||||
_PWG_MEDIA_IN("na_6x9_6x9in", "na-6x9-envelope", NULL, 6, 9),
|
||||
_PWG_MEDIA_IN("na_c5_6.5x9.5in", NULL, NULL, 6.5, 9.5),
|
||||
_PWG_MEDIA_IN("na_6x9_6x9in", "na-6x9-envelope", "6x9", 6, 9),
|
||||
_PWG_MEDIA_IN("na_c5_6.5x9.5in", NULL, "6.5x9.5", 6.5, 9.5),
|
||||
_PWG_MEDIA_IN("na_7x9_7x9in", "na-7x9-envelope", "7x9", 7, 9),
|
||||
_PWG_MEDIA_IN("na_executive_7.25x10.5in", "executive", "Executive", 7.25, 10.5),
|
||||
_PWG_MEDIA_IN("na_govt-letter_8x10in", "na-8x10", "8x10", 8, 10),
|
||||
_PWG_MEDIA_IN("na_govt-legal_8x13in", NULL, NULL, 8, 13),
|
||||
_PWG_MEDIA_IN("na_govt-legal_8x13in", NULL, "8x13", 8, 13),
|
||||
_PWG_MEDIA_IN("na_quarto_8.5x10.83in", "quarto", "Quarto", 8.5, 10.83),
|
||||
_PWG_MEDIA_IN("na_letter_8.5x11in", "na-letter", "Letter", 8.5, 11),
|
||||
_PWG_MEDIA_IN("na_fanfold-eur_8.5x12in", NULL, "FanFoldGerman", 8.5, 12),
|
||||
@@ -95,15 +95,15 @@ static _pwg_media_t const cups_pwg_media[] =
|
||||
_PWG_MEDIA_IN("na_10x11_10x11in", NULL, "10x11", 10, 11),
|
||||
_PWG_MEDIA_IN("na_10x13_10x13in", "na-10x13-envelope", "10x13", 10, 13),
|
||||
_PWG_MEDIA_IN("na_10x14_10x14in", "na-10x14-envelope", "10x14", 10, 14),
|
||||
_PWG_MEDIA_IN("na_10x15_10x15in", "na-10x15-envelope", NULL, 10, 15),
|
||||
_PWG_MEDIA_IN("na_11x12_11x12in", NULL, NULL, 11, 12),
|
||||
_PWG_MEDIA_IN("na_edp_11x14in", NULL, NULL, 11, 14),
|
||||
_PWG_MEDIA_IN("na_10x15_10x15in", "na-10x15-envelope", "10x15", 10, 15),
|
||||
_PWG_MEDIA_IN("na_11x12_11x12in", NULL, "11x12", 11, 12),
|
||||
_PWG_MEDIA_IN("na_edp_11x14in", NULL, "11x14", 11, 14),
|
||||
_PWG_MEDIA_IN("na_fanfold-us_11x14.875in", NULL, NULL, 11, 14.875),
|
||||
_PWG_MEDIA_IN("na_11x15_11x15in", NULL, NULL, 11, 15),
|
||||
_PWG_MEDIA_IN("na_11x15_11x15in", NULL, "11x15", 11, 15),
|
||||
_PWG_MEDIA_IN("na_ledger_11x17in", "tabloid", "Tabloid", 11, 17),
|
||||
_PWG_MEDIA_IN("na_eur-edp_12x14in", NULL, NULL, 12, 14),
|
||||
_PWG_MEDIA_IN("na_arch-b_12x18in", "arch-b", "ARCHB", 12, 18),
|
||||
_PWG_MEDIA_IN("na_12x19_12x19in", NULL, NULL, 12, 19),
|
||||
_PWG_MEDIA_IN("na_12x19_12x19in", NULL, "12x19", 12, 19),
|
||||
_PWG_MEDIA_IN("na_b-plus_12x19.17in", NULL, "SuperB", 12, 19.17),
|
||||
_PWG_MEDIA_IN("na_super-b_13x19in", "super-b", NULL, 13, 19),
|
||||
_PWG_MEDIA_IN("na_c_17x22in", "c", "AnsiC", 17, 22),
|
||||
@@ -114,7 +114,7 @@ static _pwg_media_t const cups_pwg_media[] =
|
||||
_PWG_MEDIA_IN("na_wide-format_30x42in", NULL, NULL, 30, 42),
|
||||
_PWG_MEDIA_IN("na_e_34x44in", "e", "AnsiE", 34, 44),
|
||||
_PWG_MEDIA_IN("na_arch-e_36x48in", "arch-e", "ARCHE", 36, 48),
|
||||
_PWG_MEDIA_IN("na_f_44x68in", NULL, NULL, 44, 68),
|
||||
_PWG_MEDIA_IN("na_f_44x68in", NULL, "AnsiF", 44, 68),
|
||||
|
||||
/* Chinese Standard Sheet Media Inch Sizes */
|
||||
_PWG_MEDIA_IN("roc_16k_7.75x10.75in", NULL, NULL, 7.75, 10.75),
|
||||
@@ -354,8 +354,8 @@ _pwgInitSize(_pwg_size_t *size, /* I - Size to initialize */
|
||||
*/
|
||||
|
||||
if ((media_size = ippFindAttribute(media_col->values[0].collection,
|
||||
"media-size",
|
||||
IPP_TAG_BEGIN_COLLECTION)) != NULL)
|
||||
"media-size",
|
||||
IPP_TAG_BEGIN_COLLECTION)) != NULL)
|
||||
{
|
||||
/*
|
||||
* Got media-size, look for x-dimension and y-dimension member
|
||||
@@ -418,12 +418,42 @@ _pwgInitSize(_pwg_size_t *size, /* I - Size to initialize */
|
||||
else
|
||||
{
|
||||
if ((media = ippFindAttribute(job, "media", IPP_TAG_NAME)) == NULL)
|
||||
media = ippFindAttribute(job, "media", IPP_TAG_KEYWORD);
|
||||
if ((media = ippFindAttribute(job, "media", IPP_TAG_KEYWORD)) == NULL)
|
||||
if ((media = ippFindAttribute(job, "PageSize", IPP_TAG_NAME)) == NULL)
|
||||
media = ippFindAttribute(job, "PageRegion", IPP_TAG_NAME);
|
||||
|
||||
if (media)
|
||||
{
|
||||
if ((pwg = _pwgMediaForPWG(media->values[0].string.text)) == NULL)
|
||||
pwg = _pwgMediaForLegacy(media->values[0].string.text);
|
||||
const char *name = media->values[0].string.text;
|
||||
/* Name string */
|
||||
|
||||
if ((pwg = _pwgMediaForPWG(name)) == NULL)
|
||||
{
|
||||
/*
|
||||
* Not a PWG name, try a legacy name...
|
||||
*/
|
||||
|
||||
if ((pwg = _pwgMediaForLegacy(name)) == NULL)
|
||||
{
|
||||
/*
|
||||
* Not a legacy name, try a PPD name...
|
||||
*/
|
||||
|
||||
const char *suffix; /* Suffix on media string */
|
||||
|
||||
pwg = _pwgMediaForPPD(name);
|
||||
if (pwg &&
|
||||
(suffix = name + strlen(name) - 10 /* .FullBleed */) > name &&
|
||||
!strcasecmp(suffix, ".FullBleed"))
|
||||
{
|
||||
/*
|
||||
* Indicate that margins are set with the default values of 0.
|
||||
*/
|
||||
|
||||
*margins_set = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (pwg)
|
||||
{
|
||||
@@ -502,7 +532,8 @@ _pwgMediaForLegacy(
|
||||
_pwg_media_t * /* O - Matching size or NULL */
|
||||
_pwgMediaForPPD(const char *ppd) /* I - PPD size name */
|
||||
{
|
||||
_pwg_media_t key; /* Search key */
|
||||
_pwg_media_t key, /* Search key */
|
||||
*size; /* Matching size */
|
||||
_cups_globals_t *cg = _cupsGlobals(); /* Global data */
|
||||
|
||||
|
||||
@@ -519,8 +550,7 @@ _pwgMediaForPPD(const char *ppd) /* I - PPD size name */
|
||||
|
||||
if (!cg->ppd_size_lut)
|
||||
{
|
||||
int i; /* Looping var */
|
||||
_pwg_media_t *size; /* Current size */
|
||||
int i; /* Looping var */
|
||||
|
||||
cg->ppd_size_lut = cupsArrayNew((cups_array_func_t)pwg_compare_ppd, NULL);
|
||||
|
||||
@@ -537,7 +567,96 @@ _pwgMediaForPPD(const char *ppd) /* I - PPD size name */
|
||||
*/
|
||||
|
||||
key.ppd = ppd;
|
||||
return ((_pwg_media_t *)cupsArrayFind(cg->ppd_size_lut, &key));
|
||||
if ((size = (_pwg_media_t *)cupsArrayFind(cg->ppd_size_lut, &key)) == NULL)
|
||||
{
|
||||
/*
|
||||
* See if the name is of the form:
|
||||
*
|
||||
* [Custom.]WIDTHxLENGTH[.FullBleed] - Size in points/inches [borderless]
|
||||
* [Custom.]WIDTHxLENGTHcm[.FullBleed] - Size in centimeters [borderless]
|
||||
* [Custom.]WIDTHxLENGTHft[.FullBleed] - Size in feet [borderless]
|
||||
* [Custom.]WIDTHxLENGTHin[.FullBleed] - Size in inches [borderless]
|
||||
* [Custom.]WIDTHxLENGTHm[.FullBleed] - Size in meters [borderless]
|
||||
* [Custom.]WIDTHxLENGTHmm[.FullBleed] - Size in millimeters [borderless]
|
||||
* [Custom.]WIDTHxLENGTHpt[.FullBleed] - Size in points [borderless]
|
||||
*/
|
||||
|
||||
double w, l, /* Width and length of page */
|
||||
factor; /* Unit scaling factor */
|
||||
char *ptr; /* Pointer into name */
|
||||
struct lconv *loc; /* Locale data */
|
||||
int custom; /* Custom page size? */
|
||||
|
||||
if (!strncasecmp(ppd, "Custom.", 7))
|
||||
{
|
||||
custom = 1;
|
||||
factor = 2540.0 / 72.0;
|
||||
ptr = (char *)ppd + 7;
|
||||
}
|
||||
else
|
||||
{
|
||||
custom = 0;
|
||||
factor = 2540.0;
|
||||
ptr = (char *)ppd;
|
||||
}
|
||||
|
||||
loc = localeconv();
|
||||
w = _cupsStrScand(ptr, &ptr, loc);
|
||||
|
||||
if (ptr && ptr > ppd && *ptr == 'x')
|
||||
{
|
||||
l = _cupsStrScand(ptr + 1, &ptr, loc);
|
||||
|
||||
if (ptr &&
|
||||
(!*ptr ||
|
||||
!strcasecmp(ptr, "FullBleed") ||
|
||||
!strcasecmp(ptr, ".FullBleed") ||
|
||||
!strcasecmp(ptr, "cm") ||
|
||||
!strcasecmp(ptr, "cm.FullBleed") ||
|
||||
!strcasecmp(ptr, "ft") ||
|
||||
!strcasecmp(ptr, "ft.FullBleed") ||
|
||||
!strcasecmp(ptr, "in") ||
|
||||
!strcasecmp(ptr, "in.FullBleed") ||
|
||||
!strcasecmp(ptr, "m") ||
|
||||
!strcasecmp(ptr, "m.FullBleed") ||
|
||||
!strcasecmp(ptr, "mm") ||
|
||||
!strcasecmp(ptr, "mm.FullBleed") ||
|
||||
!strcasecmp(ptr, "pt") ||
|
||||
!strcasecmp(ptr, "pt.FullBleed")))
|
||||
{
|
||||
size = &(cg->pwg_media);
|
||||
|
||||
if (!strncasecmp(ptr, "cm", 2))
|
||||
factor = 1000.0;
|
||||
else if (!strncasecmp(ptr, "ft", 2))
|
||||
factor = 2540.0 * 12.0;
|
||||
else if (!strncasecmp(ptr, "in", 2))
|
||||
factor = 2540.0;
|
||||
else if (!strncasecmp(ptr, "mm", 2))
|
||||
factor = 100.0;
|
||||
else if (*ptr == 'm' || *ptr == 'M')
|
||||
factor = 100000.0;
|
||||
else if (!strncasecmp(ptr, "pt", 2))
|
||||
factor = 2540.0 / 72.0;
|
||||
|
||||
/*
|
||||
* Not a standard size; convert it to a PWG custom name of the form:
|
||||
*
|
||||
* [oe|om]_WIDTHxHEIGHTuu_WIDTHxHEIGHTuu
|
||||
*/
|
||||
|
||||
size->width = (int)(w * factor);
|
||||
size->length = (int)(l * factor);
|
||||
size->pwg = cg->pwg_name;
|
||||
|
||||
_pwgGenerateSize(cg->pwg_name, sizeof(cg->pwg_name),
|
||||
custom ? "custom" : NULL, custom ? ppd + 7 : NULL,
|
||||
size->width, size->length);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return (size);
|
||||
}
|
||||
|
||||
|
||||
@@ -548,7 +667,9 @@ _pwgMediaForPPD(const char *ppd) /* I - PPD size name */
|
||||
_pwg_media_t * /* O - Matching size or NULL */
|
||||
_pwgMediaForPWG(const char *pwg) /* I - PWG size name */
|
||||
{
|
||||
_pwg_media_t key; /* Search key */
|
||||
char *ptr; /* Pointer into name */
|
||||
_pwg_media_t key, /* Search key */
|
||||
*size; /* Matching size */
|
||||
_cups_globals_t *cg = _cupsGlobals(); /* Global data */
|
||||
|
||||
|
||||
@@ -565,8 +686,7 @@ _pwgMediaForPWG(const char *pwg) /* I - PWG size name */
|
||||
|
||||
if (!cg->pwg_size_lut)
|
||||
{
|
||||
int i; /* Looping var */
|
||||
_pwg_media_t *size; /* Current size */
|
||||
int i; /* Looping var */
|
||||
|
||||
cg->pwg_size_lut = cupsArrayNew((cups_array_func_t)pwg_compare_pwg, NULL);
|
||||
|
||||
@@ -582,7 +702,50 @@ _pwgMediaForPWG(const char *pwg) /* I - PWG size name */
|
||||
*/
|
||||
|
||||
key.pwg = pwg;
|
||||
return ((_pwg_media_t *)cupsArrayFind(cg->pwg_size_lut, &key));
|
||||
if ((size = (_pwg_media_t *)cupsArrayFind(cg->pwg_size_lut, &key)) == NULL &&
|
||||
(ptr = (char *)strchr(pwg, '_')) != NULL &&
|
||||
(ptr = (char *)strchr(ptr + 1, '_')) != NULL)
|
||||
{
|
||||
/*
|
||||
* Try decoding the self-describing name of the form:
|
||||
*
|
||||
* class_name_WWWxHHHin
|
||||
* class_name_WWWxHHHmm
|
||||
*/
|
||||
|
||||
double w, l; /* Width and length of page */
|
||||
struct lconv *loc; /* Locale data */
|
||||
|
||||
ptr ++;
|
||||
loc = localeconv();
|
||||
w = _cupsStrScand(ptr, &ptr, loc);
|
||||
|
||||
if (ptr && *ptr == 'x')
|
||||
{
|
||||
l = _cupsStrScand(ptr + 1, &ptr, loc);
|
||||
|
||||
if (ptr && (!strcmp(ptr, "in") || !strcmp(ptr, "mm")))
|
||||
{
|
||||
size = &(cg->pwg_media);
|
||||
|
||||
if (!strcmp(ptr, "mm"))
|
||||
{
|
||||
size->width = (int)(w * 100);
|
||||
size->length = (int)(l * 100);
|
||||
}
|
||||
else
|
||||
{
|
||||
size->width = (int)(w * 2540);
|
||||
size->length = (int)(l * 2540);
|
||||
}
|
||||
|
||||
strlcpy(cg->pwg_name, pwg, sizeof(cg->pwg_name));
|
||||
size->pwg = cg->pwg_name;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return (size);
|
||||
}
|
||||
|
||||
|
||||
|
||||
+449
-34
@@ -48,6 +48,13 @@
|
||||
#include <math.h>
|
||||
|
||||
|
||||
/*
|
||||
* Macro to test for two almost-equal PWG measurements.
|
||||
*/
|
||||
|
||||
#define _PWG_EQUIVALENT(x, y) (abs((x)-(y)) < 2)
|
||||
|
||||
|
||||
/*
|
||||
* Local functions...
|
||||
*/
|
||||
@@ -63,20 +70,44 @@ static void pwg_unppdize_name(const char *ppd, char *name, size_t namesize);
|
||||
_pwg_t * /* O - PWG mapping data */
|
||||
_pwgCreateWithPPD(ppd_file_t *ppd) /* I - PPD file */
|
||||
{
|
||||
int i, j; /* Looping vars */
|
||||
_pwg_t *pwg; /* PWG mapping data */
|
||||
ppd_option_t *input_slot, /* InputSlot option */
|
||||
*media_type, /* MediaType option */
|
||||
*output_bin; /* OutputBin option */
|
||||
ppd_choice_t *choice; /* Current InputSlot/MediaType */
|
||||
_pwg_map_t *map; /* Current source/type map */
|
||||
ppd_size_t *ppd_size; /* Current PPD size */
|
||||
_pwg_size_t *pwg_size; /* Current PWG size */
|
||||
char pwg_keyword[3 + PPD_MAX_NAME + 1 + 12 + 1 + 12 + 3],
|
||||
int i, j, k; /* Looping vars */
|
||||
_pwg_t *pwg; /* PWG mapping data */
|
||||
ppd_option_t *input_slot, /* InputSlot option */
|
||||
*media_type, /* MediaType option */
|
||||
*output_bin, /* OutputBin option */
|
||||
*color_model, /* ColorModel option */
|
||||
*duplex; /* Duplex option */
|
||||
ppd_choice_t *choice; /* Current InputSlot/MediaType */
|
||||
_pwg_map_t *map; /* Current source/type map */
|
||||
ppd_attr_t *ppd_attr; /* Current PPD preset attribute */
|
||||
int num_options; /* Number of preset options and props */
|
||||
cups_option_t *options; /* Preset options and properties */
|
||||
ppd_size_t *ppd_size; /* Current PPD size */
|
||||
_pwg_size_t *pwg_size; /* Current PWG size */
|
||||
char pwg_keyword[3 + PPD_MAX_NAME + 1 + 12 + 1 + 12 + 3],
|
||||
/* PWG keyword string */
|
||||
ppd_name[PPD_MAX_NAME]; /* Normalized PPD name */
|
||||
const char *pwg_name; /* Standard PWG media name */
|
||||
_pwg_media_t *pwg_media; /* PWG media data */
|
||||
ppd_name[PPD_MAX_NAME];
|
||||
/* Normalized PPD name */
|
||||
const char *pwg_name; /* Standard PWG media name */
|
||||
_pwg_media_t *pwg_media; /* PWG media data */
|
||||
_pwg_output_mode_t pwg_output_mode;/* output-mode index */
|
||||
_pwg_print_quality_t pwg_print_quality;
|
||||
/* print-quality index */
|
||||
int similar; /* Are the old and new size similar? */
|
||||
_pwg_size_t *old_size; /* Current old size */
|
||||
int old_imageable, /* Old imageable length in 2540ths */
|
||||
old_borderless, /* Old borderless state */
|
||||
old_known_pwg; /* Old PWG name is well-known */
|
||||
int new_width, /* New width in 2540ths */
|
||||
new_length, /* New length in 2540ths */
|
||||
new_left, /* New left margin in 2540ths */
|
||||
new_bottom, /* New bottom margin in 2540ths */
|
||||
new_right, /* New right margin in 2540ths */
|
||||
new_top, /* New top margin in 2540ths */
|
||||
new_imageable, /* New imageable length in 2540ths */
|
||||
new_borderless, /* New borderless state */
|
||||
new_known_pwg; /* New PWG name is well-known */
|
||||
_pwg_size_t *new_size; /* New size to add, if any */
|
||||
|
||||
|
||||
DEBUG_printf(("_pwgCreateWithPPD(ppd=%p)", ppd));
|
||||
@@ -125,7 +156,7 @@ _pwgCreateWithPPD(ppd_file_t *ppd) /* I - PPD file */
|
||||
|
||||
if (!strcasecmp(ppd_size->name, "Custom"))
|
||||
continue;
|
||||
|
||||
|
||||
/*
|
||||
* Convert the PPD size name to the corresponding PWG keyword name.
|
||||
*/
|
||||
@@ -150,7 +181,8 @@ _pwgCreateWithPPD(ppd_file_t *ppd) /* I - PPD file */
|
||||
* Standard name and no conflicts, use it!
|
||||
*/
|
||||
|
||||
pwg_name = pwg_media->pwg;
|
||||
pwg_name = pwg_media->pwg;
|
||||
new_known_pwg = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -160,7 +192,8 @@ _pwgCreateWithPPD(ppd_file_t *ppd) /* I - PPD file */
|
||||
* pp_lowerppd_WIDTHxHEIGHTuu
|
||||
*/
|
||||
|
||||
pwg_name = pwg_keyword;
|
||||
pwg_name = pwg_keyword;
|
||||
new_known_pwg = 0;
|
||||
|
||||
pwg_unppdize_name(ppd_size->name, ppd_name, sizeof(ppd_name));
|
||||
_pwgGenerateSize(pwg_keyword, sizeof(pwg_keyword), NULL, ppd_name,
|
||||
@@ -169,20 +202,75 @@ _pwgCreateWithPPD(ppd_file_t *ppd) /* I - PPD file */
|
||||
}
|
||||
|
||||
/*
|
||||
* Save this size...
|
||||
* If we have a similar paper with non-zero margins then we only
|
||||
* want to keep it if it has a larger imageable area length.
|
||||
*/
|
||||
|
||||
pwg_size->map.ppd = _cupsStrAlloc(ppd_size->name);
|
||||
pwg_size->map.pwg = _cupsStrAlloc(pwg_name);
|
||||
pwg_size->width = _PWG_FROMPTS(ppd_size->width);
|
||||
pwg_size->length = _PWG_FROMPTS(ppd_size->length);
|
||||
pwg_size->left = _PWG_FROMPTS(ppd_size->left);
|
||||
pwg_size->bottom = _PWG_FROMPTS(ppd_size->bottom);
|
||||
pwg_size->right = _PWG_FROMPTS(ppd_size->width - ppd_size->right);
|
||||
pwg_size->top = _PWG_FROMPTS(ppd_size->length - ppd_size->top);
|
||||
new_width = _PWG_FROMPTS(ppd_size->width);
|
||||
new_length = _PWG_FROMPTS(ppd_size->length);
|
||||
new_left = _PWG_FROMPTS(ppd_size->left);
|
||||
new_bottom = _PWG_FROMPTS(ppd_size->bottom);
|
||||
new_right = _PWG_FROMPTS(ppd_size->width - ppd_size->right);
|
||||
new_top = _PWG_FROMPTS(ppd_size->length - ppd_size->top);
|
||||
new_imageable = new_length - new_top - new_bottom;
|
||||
new_borderless = new_bottom == 0 && new_top == 0 &&
|
||||
new_left == 0 && new_right == 0;
|
||||
|
||||
pwg->num_sizes ++;
|
||||
pwg_size ++;
|
||||
for (k = pwg->num_sizes, similar = 0, old_size = pwg->sizes, new_size = NULL;
|
||||
k > 0 && !similar;
|
||||
k --, old_size ++)
|
||||
{
|
||||
old_imageable = old_size->length - old_size->top - old_size->bottom;
|
||||
old_borderless = old_size->left == 0 && old_size->bottom == 0 &&
|
||||
old_size->right == 0 && old_size->top == 0;
|
||||
old_known_pwg = strncmp(old_size->map.pwg, "oe_", 3) &&
|
||||
strncmp(old_size->map.pwg, "om_", 3);
|
||||
|
||||
similar = old_borderless == new_borderless &&
|
||||
_PWG_EQUIVALENT(old_size->width, new_width) &&
|
||||
_PWG_EQUIVALENT(old_size->length, new_length);
|
||||
|
||||
if (similar &&
|
||||
(new_known_pwg || (!old_known_pwg && new_imageable > old_imageable)))
|
||||
{
|
||||
/*
|
||||
* The new paper has a larger imageable area so it could replace
|
||||
* the older paper. Regardless of the imageable area, we always
|
||||
* prefer the size with a well-known PWG name.
|
||||
*/
|
||||
|
||||
new_size = old_size;
|
||||
_cupsStrFree(old_size->map.ppd);
|
||||
_cupsStrFree(old_size->map.pwg);
|
||||
}
|
||||
}
|
||||
|
||||
if (!similar)
|
||||
{
|
||||
/*
|
||||
* The paper was unique enough to deserve its own entry so add it to the
|
||||
* end.
|
||||
*/
|
||||
|
||||
new_size = pwg_size ++;
|
||||
pwg->num_sizes ++;
|
||||
}
|
||||
|
||||
if (new_size)
|
||||
{
|
||||
/*
|
||||
* Save this size...
|
||||
*/
|
||||
|
||||
new_size->map.ppd = _cupsStrAlloc(ppd_size->name);
|
||||
new_size->map.pwg = _cupsStrAlloc(pwg_name);
|
||||
new_size->width = new_width;
|
||||
new_size->length = new_length;
|
||||
new_size->left = new_left;
|
||||
new_size->bottom = new_bottom;
|
||||
new_size->right = new_right;
|
||||
new_size->top = new_top;
|
||||
}
|
||||
}
|
||||
|
||||
if (ppd->variable_sizes)
|
||||
@@ -215,8 +303,13 @@ _pwgCreateWithPPD(ppd_file_t *ppd) /* I - PPD file */
|
||||
* Copy and convert InputSlot data...
|
||||
*/
|
||||
|
||||
if ((input_slot = ppdFindOption(ppd, "InputSlot")) != NULL)
|
||||
if ((input_slot = ppdFindOption(ppd, "InputSlot")) == NULL)
|
||||
input_slot = ppdFindOption(ppd, "HPPaperSource");
|
||||
|
||||
if (input_slot)
|
||||
{
|
||||
pwg->source_option = _cupsStrAlloc(input_slot->keyword);
|
||||
|
||||
if ((pwg->sources = calloc(input_slot->num_choices,
|
||||
sizeof(_pwg_map_t))) == NULL)
|
||||
{
|
||||
@@ -237,6 +330,10 @@ _pwgCreateWithPPD(ppd_file_t *ppd) /* I - PPD file */
|
||||
pwg_name = "auto";
|
||||
else if (!strcasecmp(choice->choice, "Cassette"))
|
||||
pwg_name = "main";
|
||||
else if (!strcasecmp(choice->choice, "PhotoTray"))
|
||||
pwg_name = "photo";
|
||||
else if (!strcasecmp(choice->choice, "CDTray"))
|
||||
pwg_name = "disc";
|
||||
else if (!strncasecmp(choice->choice, "Multipurpose", 12) ||
|
||||
!strcasecmp(choice->choice, "MP") ||
|
||||
!strcasecmp(choice->choice, "MPTray"))
|
||||
@@ -362,6 +459,238 @@ _pwgCreateWithPPD(ppd_file_t *ppd) /* I - PPD file */
|
||||
}
|
||||
}
|
||||
|
||||
if ((ppd_attr = ppdFindAttr(ppd, "APPrinterPreset", NULL)) != NULL)
|
||||
{
|
||||
/*
|
||||
* Copy and convert APPrinterPreset (output-mode + print-quality) data...
|
||||
*/
|
||||
|
||||
const char *quality, /* com.apple.print.preset.quality value */
|
||||
*output_mode, /* com.apple.print.preset.output-mode value */
|
||||
*color_model_val, /* ColorModel choice */
|
||||
*graphics_type, /* com.apple.print.preset.graphicsType value */
|
||||
*paper_coating; /* com.apple.print.preset.media-front-coating value */
|
||||
|
||||
|
||||
do
|
||||
{
|
||||
num_options = _ppdParseOptions(ppd_attr->value, 0, &options,
|
||||
_PPD_PARSE_ALL);
|
||||
|
||||
if ((quality = cupsGetOption("com.apple.print.preset.quality",
|
||||
num_options, options)) != NULL)
|
||||
{
|
||||
/*
|
||||
* Get the print-quality for this preset...
|
||||
*/
|
||||
|
||||
if (!strcmp(quality, "low"))
|
||||
pwg_print_quality = _PWG_PRINT_QUALITY_DRAFT;
|
||||
else if (!strcmp(quality, "high"))
|
||||
pwg_print_quality = _PWG_PRINT_QUALITY_HIGH;
|
||||
else
|
||||
pwg_print_quality = _PWG_PRINT_QUALITY_NORMAL;
|
||||
|
||||
/*
|
||||
* Ignore graphicsType "Photo" presets that are not high quality.
|
||||
*/
|
||||
|
||||
graphics_type = cupsGetOption("com.apple.print.preset.graphicsType",
|
||||
num_options, options);
|
||||
|
||||
if (pwg_print_quality != _PWG_PRINT_QUALITY_HIGH && graphics_type &&
|
||||
!strcmp(graphics_type, "Photo"))
|
||||
continue;
|
||||
|
||||
/*
|
||||
* Ignore presets for normal and draft quality where the coating
|
||||
* isn't "none" or "autodetect".
|
||||
*/
|
||||
|
||||
paper_coating = cupsGetOption(
|
||||
"com.apple.print.preset.media-front-coating",
|
||||
num_options, options);
|
||||
|
||||
if (pwg_print_quality != _PWG_PRINT_QUALITY_HIGH && paper_coating &&
|
||||
strcmp(paper_coating, "none") &&
|
||||
strcmp(paper_coating, "autodetect"))
|
||||
continue;
|
||||
|
||||
/*
|
||||
* Get the output mode for this preset...
|
||||
*/
|
||||
|
||||
output_mode = cupsGetOption("com.apple.print.preset.output-mode",
|
||||
num_options, options);
|
||||
color_model_val = cupsGetOption("ColorModel", num_options, options);
|
||||
|
||||
if (output_mode)
|
||||
{
|
||||
if (!strcmp(output_mode, "monochrome"))
|
||||
pwg_output_mode = _PWG_OUTPUT_MODE_MONOCHROME;
|
||||
else
|
||||
pwg_output_mode = _PWG_OUTPUT_MODE_COLOR;
|
||||
}
|
||||
else if (color_model_val)
|
||||
{
|
||||
if (!strcasecmp(color_model_val, "Gray"))
|
||||
pwg_output_mode = _PWG_OUTPUT_MODE_MONOCHROME;
|
||||
else
|
||||
pwg_output_mode = _PWG_OUTPUT_MODE_COLOR;
|
||||
}
|
||||
else
|
||||
pwg_output_mode = _PWG_OUTPUT_MODE_COLOR;
|
||||
|
||||
/*
|
||||
* Save the options for this combination as needed...
|
||||
*/
|
||||
|
||||
if (!pwg->num_presets[pwg_output_mode][pwg_print_quality])
|
||||
pwg->num_presets[pwg_output_mode][pwg_print_quality] =
|
||||
_ppdParseOptions(ppd_attr->value, 0,
|
||||
pwg->presets[pwg_output_mode] +
|
||||
pwg_print_quality, _PPD_PARSE_OPTIONS);
|
||||
}
|
||||
|
||||
cupsFreeOptions(num_options, options);
|
||||
}
|
||||
while ((ppd_attr = ppdFindNextAttr(ppd, "APPrinterPreset", NULL)) != NULL);
|
||||
}
|
||||
|
||||
if (!pwg->num_presets[_PWG_OUTPUT_MODE_MONOCHROME][_PWG_PRINT_QUALITY_DRAFT] &&
|
||||
!pwg->num_presets[_PWG_OUTPUT_MODE_MONOCHROME][_PWG_PRINT_QUALITY_NORMAL] &&
|
||||
!pwg->num_presets[_PWG_OUTPUT_MODE_MONOCHROME][_PWG_PRINT_QUALITY_HIGH])
|
||||
{
|
||||
/*
|
||||
* Try adding some common color options to create grayscale presets. These
|
||||
* are listed in order of popularity...
|
||||
*/
|
||||
|
||||
const char *color_option = NULL, /* Color control option */
|
||||
*gray_choice = NULL; /* Choice to select grayscale */
|
||||
|
||||
if ((color_model = ppdFindOption(ppd, "ColorModel")) != NULL &&
|
||||
ppdFindChoice(color_model, "Gray"))
|
||||
{
|
||||
color_option = "ColorModel";
|
||||
gray_choice = "Gray";
|
||||
}
|
||||
else if ((color_model = ppdFindOption(ppd, "HPColorMode")) != NULL &&
|
||||
ppdFindChoice(color_model, "grayscale"))
|
||||
{
|
||||
color_option = "HPColorMode";
|
||||
gray_choice = "grayscale";
|
||||
}
|
||||
else if ((color_model = ppdFindOption(ppd, "BRMonoColor")) != NULL &&
|
||||
ppdFindChoice(color_model, "Mono"))
|
||||
{
|
||||
color_option = "BRMonoColor";
|
||||
gray_choice = "Mono";
|
||||
}
|
||||
else if ((color_model = ppdFindOption(ppd, "CNIJSGrayScale")) != NULL &&
|
||||
ppdFindChoice(color_model, "1"))
|
||||
{
|
||||
color_option = "CNIJSGrayScale";
|
||||
gray_choice = "1";
|
||||
}
|
||||
else if ((color_model = ppdFindOption(ppd, "HPColorAsGray")) != NULL &&
|
||||
ppdFindChoice(color_model, "True"))
|
||||
{
|
||||
color_option = "HPColorAsGray";
|
||||
gray_choice = "True";
|
||||
}
|
||||
|
||||
if (color_option && gray_choice)
|
||||
{
|
||||
/*
|
||||
* Copy and convert ColorModel (output-mode) data...
|
||||
*/
|
||||
|
||||
cups_option_t *coption, /* Color option */
|
||||
*moption; /* Monochrome option */
|
||||
|
||||
for (pwg_print_quality = _PWG_PRINT_QUALITY_DRAFT;
|
||||
pwg_print_quality < _PWG_PRINT_QUALITY_MAX;
|
||||
pwg_print_quality ++)
|
||||
{
|
||||
if (pwg->num_presets[_PWG_OUTPUT_MODE_COLOR][pwg_print_quality])
|
||||
{
|
||||
/*
|
||||
* Copy the color options...
|
||||
*/
|
||||
|
||||
num_options = pwg->num_presets[_PWG_OUTPUT_MODE_COLOR]
|
||||
[pwg_print_quality];
|
||||
options = calloc(sizeof(cups_option_t), num_options);
|
||||
|
||||
if (options)
|
||||
{
|
||||
for (i = num_options, moption = options,
|
||||
coption = pwg->presets[_PWG_OUTPUT_MODE_COLOR]
|
||||
[pwg_print_quality];
|
||||
i > 0;
|
||||
i --, moption ++, coption ++)
|
||||
{
|
||||
moption->name = _cupsStrRetain(coption->name);
|
||||
moption->value = _cupsStrRetain(coption->value);
|
||||
}
|
||||
|
||||
pwg->num_presets[_PWG_OUTPUT_MODE_MONOCHROME][pwg_print_quality] =
|
||||
num_options;
|
||||
pwg->presets[_PWG_OUTPUT_MODE_MONOCHROME][pwg_print_quality] =
|
||||
options;
|
||||
}
|
||||
}
|
||||
else if (pwg_print_quality != _PWG_PRINT_QUALITY_NORMAL)
|
||||
continue;
|
||||
|
||||
/*
|
||||
* Add the grayscale option to the preset...
|
||||
*/
|
||||
|
||||
pwg->num_presets[_PWG_OUTPUT_MODE_MONOCHROME][pwg_print_quality] =
|
||||
cupsAddOption(color_option, gray_choice,
|
||||
pwg->num_presets[_PWG_OUTPUT_MODE_MONOCHROME]
|
||||
[pwg_print_quality],
|
||||
pwg->presets[_PWG_OUTPUT_MODE_MONOCHROME] +
|
||||
pwg_print_quality);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Copy and convert Duplex (sides) data...
|
||||
*/
|
||||
|
||||
if ((duplex = ppdFindOption(ppd, "Duplex")) == NULL)
|
||||
if ((duplex = ppdFindOption(ppd, "JCLDuplex")) == NULL)
|
||||
if ((duplex = ppdFindOption(ppd, "EFDuplex")) == NULL)
|
||||
if ((duplex = ppdFindOption(ppd, "EFDuplexing")) == NULL)
|
||||
duplex = ppdFindOption(ppd, "KD03Duplex");
|
||||
|
||||
if (duplex)
|
||||
{
|
||||
pwg->sides_option = _cupsStrAlloc(duplex->keyword);
|
||||
|
||||
for (i = duplex->num_choices, choice = duplex->choices;
|
||||
i > 0;
|
||||
i --, choice ++)
|
||||
{
|
||||
if ((!strcasecmp(choice->choice, "None") ||
|
||||
!strcasecmp(choice->choice, "False")) && !pwg->sides_1sided)
|
||||
pwg->sides_1sided = _cupsStrAlloc(choice->choice);
|
||||
else if ((!strcasecmp(choice->choice, "DuplexNoTumble") ||
|
||||
!strcasecmp(choice->choice, "LongEdge") ||
|
||||
!strcasecmp(choice->choice, "Top")) && !pwg->sides_2sided_long)
|
||||
pwg->sides_2sided_long = _cupsStrAlloc(choice->choice);
|
||||
else if ((!strcasecmp(choice->choice, "DuplexTumble") ||
|
||||
!strcasecmp(choice->choice, "ShortEdge") ||
|
||||
!strcasecmp(choice->choice, "Bottom")) &&
|
||||
!pwg->sides_2sided_short)
|
||||
pwg->sides_2sided_short = _cupsStrAlloc(choice->choice);
|
||||
}
|
||||
}
|
||||
|
||||
return (pwg);
|
||||
|
||||
/*
|
||||
@@ -434,13 +763,30 @@ _pwgGetInputSlot(_pwg_t *pwg, /* I - PWG mapping data */
|
||||
|
||||
ipp_attribute_t *media_col, /* media-col attribute */
|
||||
*media_source; /* media-source attribute */
|
||||
_pwg_size_t size; /* Dimensional size */
|
||||
int margins_set; /* Were the margins set? */
|
||||
|
||||
media_col = ippFindAttribute(job, "media-col", IPP_TAG_BEGIN_COLLECTION);
|
||||
if (media_col &&
|
||||
(media_source = ippFindAttribute(media_col->values[0].collection,
|
||||
"media-source",
|
||||
IPP_TAG_KEYWORD)) != NULL)
|
||||
{
|
||||
/*
|
||||
* Use the media-source value from media-col...
|
||||
*/
|
||||
|
||||
keyword = media_source->values[0].string.text;
|
||||
}
|
||||
else if (_pwgInitSize(&size, job, &margins_set))
|
||||
{
|
||||
/*
|
||||
* For media <= 5x7, look for a photo tray...
|
||||
*/
|
||||
|
||||
if (size.width <= (5 * 2540) && size.length <= (7 * 2540))
|
||||
keyword = "photo";
|
||||
}
|
||||
}
|
||||
|
||||
if (keyword)
|
||||
@@ -565,8 +911,12 @@ _pwgGetPageSize(_pwg_t *pwg, /* I - PWG mapping data */
|
||||
dtop, /* Difference in top margins */
|
||||
dmin, /* Minimum difference */
|
||||
dclosest; /* Closest difference */
|
||||
const char *ppd_name; /* PPD media name */
|
||||
|
||||
|
||||
DEBUG_printf(("_pwgGetPageSize(pwg=%p, job=%p, keyword=\"%s\", exact=%p)",
|
||||
pwg, job, keyword, exact));
|
||||
|
||||
/*
|
||||
* Range check input...
|
||||
*/
|
||||
@@ -577,6 +927,58 @@ _pwgGetPageSize(_pwg_t *pwg, /* I - PWG mapping data */
|
||||
if (exact)
|
||||
*exact = 0;
|
||||
|
||||
ppd_name = keyword;
|
||||
|
||||
if (job)
|
||||
{
|
||||
/*
|
||||
* Try getting the PPD media name from the job attributes...
|
||||
*/
|
||||
|
||||
ipp_attribute_t *attr; /* Job attribute */
|
||||
|
||||
if ((attr = ippFindAttribute(job, "PageSize", IPP_TAG_ZERO)) == NULL)
|
||||
if ((attr = ippFindAttribute(job, "PageRegion", IPP_TAG_ZERO)) == NULL)
|
||||
attr = ippFindAttribute(job, "media", IPP_TAG_ZERO);
|
||||
|
||||
#ifdef DEBUG
|
||||
if (attr)
|
||||
DEBUG_printf(("1_pwgGetPageSize: Found attribute %s (%s)", attr->name,
|
||||
ippTagString(attr->value_tag)));
|
||||
else
|
||||
DEBUG_puts("1_pwgGetPageSize: Did not find media attribute.");
|
||||
#endif /* DEBUG */
|
||||
|
||||
if (attr && (attr->value_tag == IPP_TAG_NAME ||
|
||||
attr->value_tag == IPP_TAG_KEYWORD))
|
||||
ppd_name = attr->values[0].string.text;
|
||||
}
|
||||
|
||||
DEBUG_printf(("1_pwgGetPageSize: ppd_name=\"%s\"", ppd_name));
|
||||
|
||||
if (ppd_name)
|
||||
{
|
||||
/*
|
||||
* Try looking up the named PPD size first...
|
||||
*/
|
||||
|
||||
for (i = pwg->num_sizes, size = pwg->sizes; i > 0; i --, size ++)
|
||||
{
|
||||
DEBUG_printf(("2_pwgGetPageSize: size[%d]=[\"%s\" \"%s\"]",
|
||||
(int)(size - pwg->sizes), size->map.pwg, size->map.ppd));
|
||||
|
||||
if (!strcasecmp(ppd_name, size->map.ppd))
|
||||
{
|
||||
if (exact)
|
||||
*exact = 1;
|
||||
|
||||
DEBUG_printf(("1_pwgGetPageSize: Returning \"%s\"", ppd_name));
|
||||
|
||||
return (ppd_name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (job && !keyword)
|
||||
{
|
||||
/*
|
||||
@@ -598,7 +1000,8 @@ _pwgGetPageSize(_pwg_t *pwg, /* I - PWG mapping data */
|
||||
|
||||
if ((media = _pwgMediaForPWG(keyword)) == NULL)
|
||||
if ((media = _pwgMediaForLegacy(keyword)) == NULL)
|
||||
return (NULL);
|
||||
if ((media = _pwgMediaForPPD(keyword)) == NULL)
|
||||
return (NULL);
|
||||
|
||||
jobsize.width = media->width;
|
||||
jobsize.length = media->length;
|
||||
@@ -659,11 +1062,18 @@ _pwgGetPageSize(_pwg_t *pwg, /* I - PWG mapping data */
|
||||
if (exact)
|
||||
*exact = 1;
|
||||
|
||||
DEBUG_printf(("1_pwgGetPageSize: Returning \"%s\"", size->map.ppd));
|
||||
|
||||
return (size->map.ppd);
|
||||
}
|
||||
|
||||
if (closest)
|
||||
{
|
||||
DEBUG_printf(("1_pwgGetPageSize: Returning \"%s\" (closest)",
|
||||
closest->map.ppd));
|
||||
|
||||
return (closest->map.ppd);
|
||||
}
|
||||
|
||||
/*
|
||||
* If we get here we need to check for custom page size support...
|
||||
@@ -695,6 +1105,9 @@ _pwgGetPageSize(_pwg_t *pwg, /* I - PWG mapping data */
|
||||
else if (exact)
|
||||
*exact = 1;
|
||||
|
||||
DEBUG_printf(("1_pwgGetPageSize: Returning \"%s\" (custom)",
|
||||
pwg->custom_ppd_size));
|
||||
|
||||
return (pwg->custom_ppd_size);
|
||||
}
|
||||
|
||||
@@ -702,6 +1115,8 @@ _pwgGetPageSize(_pwg_t *pwg, /* I - PWG mapping data */
|
||||
* No custom page size support or the size is out of range - return NULL.
|
||||
*/
|
||||
|
||||
DEBUG_puts("1_pwgGetPageSize: Returning NULL");
|
||||
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
@@ -1024,7 +1439,7 @@ pwg_ppdize_name(const char *ipp, /* I - IPP keyword */
|
||||
|
||||
for (ptr = name + 1, end = name + namesize - 1; *ipp && ptr < end;)
|
||||
{
|
||||
if (*ipp == '-' && isalpha(ipp[1] & 255))
|
||||
if (*ipp == '-' && _cups_isalpha(ipp[1]))
|
||||
{
|
||||
ipp ++;
|
||||
*ptr++ = toupper(*ipp++ & 255);
|
||||
@@ -1052,13 +1467,13 @@ pwg_unppdize_name(const char *ppd, /* I - PPD keyword */
|
||||
|
||||
for (ptr = name, end = name + namesize - 1; *ppd && ptr < end; ppd ++)
|
||||
{
|
||||
if (isalnum(*ppd & 255) || *ppd == '-' || *ppd == '.')
|
||||
if (_cups_isalnum(*ppd) || *ppd == '-')
|
||||
*ptr++ = tolower(*ppd & 255);
|
||||
else if (*ppd == '_')
|
||||
else if (*ppd == '_' || *ppd == '.')
|
||||
*ptr++ = '-';
|
||||
|
||||
if (!isupper(*ppd & 255) && isalnum(*ppd & 255) &&
|
||||
isupper(ppd[1] & 255) && ptr < end)
|
||||
if (!_cups_isupper(*ppd) && _cups_isalnum(*ppd) &&
|
||||
_cups_isupper(ppd[1]) && ptr < end)
|
||||
*ptr++ = '-';
|
||||
}
|
||||
|
||||
|
||||
@@ -48,6 +48,21 @@ extern "C" {
|
||||
* Types and structures...
|
||||
*/
|
||||
|
||||
typedef enum _pwg_output_mode_e /**** PWG output-mode indices ****/
|
||||
{
|
||||
_PWG_OUTPUT_MODE_MONOCHROME = 0, /* output-mode=monochrome */
|
||||
_PWG_OUTPUT_MODE_COLOR, /* output-mode=color */
|
||||
_PWG_OUTPUT_MODE_MAX
|
||||
} _pwg_output_mode_t;
|
||||
|
||||
typedef enum _pwg_print_quality_e /**** PWG print-quality indices ****/
|
||||
{
|
||||
_PWG_PRINT_QUALITY_DRAFT = 0, /* print-quality=3 */
|
||||
_PWG_PRINT_QUALITY_NORMAL, /* print-quality=4 */
|
||||
_PWG_PRINT_QUALITY_HIGH, /* print-quality=5 */
|
||||
_PWG_PRINT_QUALITY_MAX
|
||||
} _pwg_print_quality_t;
|
||||
|
||||
typedef struct _pwg_media_s /**** Common media size data ****/
|
||||
{
|
||||
const char *pwg, /* PWG 5101.1 "self describing" name */
|
||||
@@ -88,10 +103,19 @@ typedef struct _pwg_s /**** PWG-PPD conversion data ****/
|
||||
*custom_min_keyword, /* Minimum custom size PWG keyword */
|
||||
custom_ppd_size[41]; /* Custom PPD size name */
|
||||
_pwg_size_t custom_size; /* Custom size record */
|
||||
char *source_option; /* PPD option for media source */
|
||||
int num_sources; /* Number of media sources */
|
||||
_pwg_map_t *sources; /* Media sources */
|
||||
int num_types; /* Number of media types */
|
||||
_pwg_map_t *types; /* Media types */
|
||||
int num_presets[_PWG_OUTPUT_MODE_MAX][_PWG_PRINT_QUALITY_MAX];
|
||||
/* Number of output-mode/print-quality options */
|
||||
cups_option_t *presets[_PWG_OUTPUT_MODE_MAX][_PWG_PRINT_QUALITY_MAX];
|
||||
/* output-mode/print-quality options */
|
||||
char *sides_option, /* PPD option for sides */
|
||||
*sides_1sided, /* Choice for one-sided */
|
||||
*sides_2sided_long, /* Choice for two-sided-long-edge */
|
||||
*sides_2sided_short; /* Choice for two-sided-short-edge */
|
||||
} _pwg_t;
|
||||
|
||||
|
||||
|
||||
+38
-20
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
* "$Id$"
|
||||
*
|
||||
* Raster file definitions for the Common UNIX Printing System (CUPS).
|
||||
* Raster file definitions for CUPS.
|
||||
*
|
||||
* Copyright 2007-2008 by Apple Inc.
|
||||
* Copyright 2007-2010 by Apple Inc.
|
||||
* Copyright 1997-2006 by Easy Software Products.
|
||||
*
|
||||
* This file is part of the CUPS Imaging library.
|
||||
@@ -84,26 +84,28 @@ typedef enum cups_bool_e /**** Boolean type ****/
|
||||
|
||||
typedef enum cups_cspace_e /**** cupsColorSpace attribute values ****/
|
||||
{
|
||||
CUPS_CSPACE_W = 0, /* Luminance */
|
||||
CUPS_CSPACE_RGB = 1, /* Red, green, blue */
|
||||
CUPS_CSPACE_RGBA = 2, /* Red, green, blue, alpha */
|
||||
CUPS_CSPACE_K = 3, /* Black */
|
||||
CUPS_CSPACE_CMY = 4, /* Cyan, magenta, yellow */
|
||||
CUPS_CSPACE_YMC = 5, /* Yellow, magenta, cyan */
|
||||
CUPS_CSPACE_CMYK = 6, /* Cyan, magenta, yellow, black */
|
||||
CUPS_CSPACE_YMCK = 7, /* Yellow, magenta, cyan, black */
|
||||
CUPS_CSPACE_KCMY = 8, /* Black, cyan, magenta, yellow */
|
||||
CUPS_CSPACE_KCMYcm = 9, /* Black, cyan, magenta, yellow, *
|
||||
* light-cyan, light-magenta */
|
||||
CUPS_CSPACE_GMCK = 10, /* Gold, magenta, yellow, black */
|
||||
CUPS_CSPACE_GMCS = 11, /* Gold, magenta, yellow, silver */
|
||||
CUPS_CSPACE_WHITE = 12, /* White ink (as black) */
|
||||
CUPS_CSPACE_GOLD = 13, /* Gold foil */
|
||||
CUPS_CSPACE_SILVER = 14, /* Silver foil */
|
||||
CUPS_CSPACE_W = 0, /* Luminance (DeviceGray, gamma 2.2 by default) */
|
||||
CUPS_CSPACE_RGB = 1, /* Red, green, blue (DeviceRGB, sRGB by default) */
|
||||
CUPS_CSPACE_RGBA = 2, /* Red, green, blue, alpha (DeviceRGB, sRGB by default) */
|
||||
CUPS_CSPACE_K = 3, /* Black (DeviceK) */
|
||||
CUPS_CSPACE_CMY = 4, /* Cyan, magenta, yellow (DeviceCMY) */
|
||||
CUPS_CSPACE_YMC = 5, /* Yellow, magenta, cyan @deprecated@ */
|
||||
CUPS_CSPACE_CMYK = 6, /* Cyan, magenta, yellow, black (DeviceCMYK) */
|
||||
CUPS_CSPACE_YMCK = 7, /* Yellow, magenta, cyan, black @deprecated@ */
|
||||
CUPS_CSPACE_KCMY = 8, /* Black, cyan, magenta, yellow @deprecated@ */
|
||||
CUPS_CSPACE_KCMYcm = 9, /* Black, cyan, magenta, yellow, light-cyan, light-magenta @deprecated@ */
|
||||
CUPS_CSPACE_GMCK = 10, /* Gold, magenta, yellow, black @deprecated@ */
|
||||
CUPS_CSPACE_GMCS = 11, /* Gold, magenta, yellow, silver @deprecated@ */
|
||||
CUPS_CSPACE_WHITE = 12, /* White ink (as black) @deprecated@ */
|
||||
CUPS_CSPACE_GOLD = 13, /* Gold foil @deprecated@ */
|
||||
CUPS_CSPACE_SILVER = 14, /* Silver foil @deprecated@ */
|
||||
|
||||
CUPS_CSPACE_CIEXYZ = 15, /* CIE XYZ @since CUPS 1.1.19/Mac OS X 10.3@ */
|
||||
CUPS_CSPACE_CIELab = 16, /* CIE Lab @since CUPS 1.1.19/Mac OS X 10.3@ */
|
||||
CUPS_CSPACE_RGBW = 17, /* Red, green, blue, white @since CUPS 1.2/Mac OS X 10.5@ */
|
||||
CUPS_CSPACE_RGBW = 17, /* Red, green, blue, white (DeviceRGB, sRGB by default) @since CUPS 1.2/Mac OS X 10.5@ */
|
||||
CUPS_CSPACE_SW = 18, /* Luminance (gamma 2.2) @since CUPS 1.4.5@ */
|
||||
CUPS_CSPACE_SRGB = 19, /* Red, green, blue (sRGB) @since CUPS 1.4.5@ */
|
||||
CUPS_CSPACE_ADOBERGB = 20, /* Red, green, blue (Adobe RGB) @since CUPS 1.4.5@ */
|
||||
|
||||
CUPS_CSPACE_ICC1 = 32, /* ICC-based, 1 color @since CUPS 1.1.19/Mac OS X 10.3@ */
|
||||
CUPS_CSPACE_ICC2 = 33, /* ICC-based, 2 colors @since CUPS 1.1.19/Mac OS X 10.3@ */
|
||||
@@ -119,7 +121,23 @@ typedef enum cups_cspace_e /**** cupsColorSpace attribute values ****/
|
||||
CUPS_CSPACE_ICCC = 43, /* ICC-based, 12 colors @since CUPS 1.1.19/Mac OS X 10.3@ */
|
||||
CUPS_CSPACE_ICCD = 44, /* ICC-based, 13 colors @since CUPS 1.1.19/Mac OS X 10.3@ */
|
||||
CUPS_CSPACE_ICCE = 45, /* ICC-based, 14 colors @since CUPS 1.1.19/Mac OS X 10.3@ */
|
||||
CUPS_CSPACE_ICCF = 46 /* ICC-based, 15 colors @since CUPS 1.1.19/Mac OS X 10.3@ */
|
||||
CUPS_CSPACE_ICCF = 46, /* ICC-based, 15 colors @since CUPS 1.1.19/Mac OS X 10.3@ */
|
||||
|
||||
CUPS_CSPACE_DEVICE1 = 48, /* DeviceN, 1 color @since CUPS 1.4.5@ */
|
||||
CUPS_CSPACE_DEVICE2 = 49, /* DeviceN, 2 colors @since CUPS 1.4.5@ */
|
||||
CUPS_CSPACE_DEVICE3 = 50, /* DeviceN, 3 colors @since CUPS 1.4.5@ */
|
||||
CUPS_CSPACE_DEVICE4 = 51, /* DeviceN, 4 colors @since CUPS 1.4.5@ */
|
||||
CUPS_CSPACE_DEVICE5 = 52, /* DeviceN, 5 colors @since CUPS 1.4.5@ */
|
||||
CUPS_CSPACE_DEVICE6 = 53, /* DeviceN, 6 colors @since CUPS 1.4.5@ */
|
||||
CUPS_CSPACE_DEVICE7 = 54, /* DeviceN, 7 colors @since CUPS 1.4.5@ */
|
||||
CUPS_CSPACE_DEVICE8 = 55, /* DeviceN, 8 colors @since CUPS 1.4.5@ */
|
||||
CUPS_CSPACE_DEVICE9 = 56, /* DeviceN, 9 colors @since CUPS 1.4.5@ */
|
||||
CUPS_CSPACE_DEVICEA = 57, /* DeviceN, 10 colors @since CUPS 1.4.5@ */
|
||||
CUPS_CSPACE_DEVICEB = 58, /* DeviceN, 11 colors @since CUPS 1.4.5@ */
|
||||
CUPS_CSPACE_DEVICEC = 59, /* DeviceN, 12 colors @since CUPS 1.4.5@ */
|
||||
CUPS_CSPACE_DEVICED = 60, /* DeviceN, 13 colors @since CUPS 1.4.5@ */
|
||||
CUPS_CSPACE_DEVICEE = 61, /* DeviceN, 14 colors @since CUPS 1.4.5@ */
|
||||
CUPS_CSPACE_DEVICEF = 62 /* DeviceN, 15 colors @since CUPS 1.4.5@ */
|
||||
} cups_cspace_t;
|
||||
|
||||
typedef enum cups_cut_e /**** CutMedia attribute values ****/
|
||||
|
||||
+2
-2
@@ -884,10 +884,10 @@ _cupsSetHTTPError(http_status_t status) /* I - HTTP status code */
|
||||
break;
|
||||
|
||||
case HTTP_UNAUTHORIZED :
|
||||
case HTTP_AUTHORIZATION_CANCELED :
|
||||
_cupsSetError(IPP_NOT_AUTHORIZED, httpStatus(status), 0);
|
||||
_cupsSetError(IPP_NOT_AUTHENTICATED, httpStatus(status), 0);
|
||||
break;
|
||||
|
||||
case HTTP_AUTHORIZATION_CANCELED :
|
||||
case HTTP_FORBIDDEN :
|
||||
_cupsSetError(IPP_FORBIDDEN, httpStatus(status), 0);
|
||||
break;
|
||||
|
||||
+2
-1
@@ -41,6 +41,7 @@
|
||||
#include <limits.h>
|
||||
#include "array.h"
|
||||
#include "debug.h"
|
||||
#define _CUPS_STRING_C_
|
||||
#include "string.h"
|
||||
#ifdef HAVE_PTHREAD_H
|
||||
# include <pthread.h>
|
||||
@@ -428,7 +429,7 @@ _cupsStrScand(const char *buf, /* I - Pointer to number */
|
||||
* Skip leading whitespace...
|
||||
*/
|
||||
|
||||
while (isspace(*buf & 255))
|
||||
while (_cups_isspace(*buf))
|
||||
buf ++;
|
||||
|
||||
/*
|
||||
|
||||
@@ -79,6 +79,62 @@ typedef struct _cups_sp_item_s /**** String Pool Item ****/
|
||||
} _cups_sp_item_t;
|
||||
|
||||
|
||||
/*
|
||||
* Replacements for the ctype macros that are not affected by locale, since we
|
||||
* really only care about testing for ASCII characters when parsing files, etc.
|
||||
* These are used only within libcups since the rest of CUPS doesn't call
|
||||
* setlocale() for LC_CTYPE and doesn't have to worry about third-party
|
||||
* libraries doing so (and if they do that is a bug: NetSNMP, I'm looking at
|
||||
* you!)
|
||||
*
|
||||
* The _CUPS_INLINE definition controls whether we get an inline function body,
|
||||
* and external function body, or an external definition.
|
||||
*/
|
||||
|
||||
# if defined(__GNUC__) || __STDC_VERSION__ >= 199901L
|
||||
# define _CUPS_INLINE static inline
|
||||
# elif defined(_MSC_VER)
|
||||
# define _CUPS_INLINE static __inline
|
||||
# elif defined(_CUPS_STRING_C_)
|
||||
# define _CUPS_INLINE
|
||||
# endif /* __GNUC__ || __STDC_VERSION__ */
|
||||
|
||||
# ifdef _CUPS_INLINE
|
||||
_CUPS_INLINE int /* O - 1 on match, 0 otherwise */
|
||||
_cups_isalnum(int ch) /* I - Character to test */
|
||||
{
|
||||
return ((ch >= '0' && ch <= '9') ||
|
||||
(ch >= 'A' && ch <= 'Z') ||
|
||||
(ch >= 'a' && ch <= 'z'));
|
||||
}
|
||||
|
||||
_CUPS_INLINE int /* O - 1 on match, 0 otherwise */
|
||||
_cups_isalpha(int ch) /* I - Character to test */
|
||||
{
|
||||
return ((ch >= 'A' && ch <= 'Z') ||
|
||||
(ch >= 'a' && ch <= 'z'));
|
||||
}
|
||||
|
||||
_CUPS_INLINE int /* O - 1 on match, 0 otherwise */
|
||||
_cups_isspace(int ch) /* I - Character to test */
|
||||
{
|
||||
return (ch == ' ' || ch == '\f' || ch == '\n' || ch == '\r' || ch == '\t' ||
|
||||
ch == '\v');
|
||||
}
|
||||
|
||||
_CUPS_INLINE int /* O - 1 on match, 0 otherwise */
|
||||
_cups_isupper(int ch) /* I - Character to test */
|
||||
{
|
||||
return (ch >= 'A' && ch <= 'Z');
|
||||
}
|
||||
# else
|
||||
extern int _cups_isalnum(int ch);
|
||||
extern int _cups_isalpha(int ch);
|
||||
extern int _cups_isspace(int ch);
|
||||
extern int _cups_isupper(int ch);
|
||||
# endif /* _CUPS_INLINE */
|
||||
|
||||
|
||||
/*
|
||||
* Prototypes...
|
||||
*/
|
||||
|
||||
@@ -65,6 +65,9 @@
|
||||
*PageSize Letter/US Letter: "PageSize=Letter"
|
||||
*fr.PageSize Letter/French US Letter: ""
|
||||
*fr_CA.PageSize Letter/French Canadian US Letter: ""
|
||||
*PageSize Letter.Banner/US Letter Banner: "PageSize=Letter.Banner"
|
||||
*fr.PageSize Letter.Banner/French US Letter Banner: ""
|
||||
*fr_CA.PageSize Letter.Banner/French Canadian US Letter Banner: ""
|
||||
*PageSize Letter.Fullbleed/US Letter Borderless: "PageSize=Letter.Fullbleed"
|
||||
*fr.PageSize Letter.Fullbleed/French US Letter Borderless: ""
|
||||
*fr_CA.PageSize Letter.Fullbleed/French Canadian US Letter Borderless: ""
|
||||
@@ -81,6 +84,7 @@
|
||||
*OrderDependency: 10 AnySetup *PageRegion
|
||||
*DefaultPageRegion: Letter
|
||||
*PageRegion Letter/US Letter: "PageRegion=Letter"
|
||||
*PageRegion Letter.Banner/US Letter Banner: "PageRegion=Letter.Fullbleed"
|
||||
*PageRegion Letter.Fullbleed/US Letter Borderless: "PageRegion=Letter.Fullbleed"
|
||||
*PageRegion A4/A4: "PageRegion=A4"
|
||||
*PageRegion Env10/#10 Envelope: "PageRegion=Env10"
|
||||
@@ -88,24 +92,28 @@
|
||||
|
||||
*fr.Translation PageRegion/French Page Region: ""
|
||||
*fr.PageRegion Letter/French US Letter: ""
|
||||
*fr.PageRegion Letter.Banner/French US Letter Banner: ""
|
||||
*fr.PageRegion Letter.Fullbleed/French US Letter Borderless: ""
|
||||
*fr.PageRegion A4/French A4: ""
|
||||
*fr.PageRegion Env10/French #10 Envelope: ""
|
||||
|
||||
*fr_CA.Translation PageRegion/French Canadian Page Region: ""
|
||||
*fr_CA.PageRegion Letter/French Canadian US Letter: ""
|
||||
*fr_CA.PageRegion Letter.Banner/French Canadian US Letter Banner: ""
|
||||
*fr_CA.PageRegion Letter.Fullbleed/French Canadian US Letter Borderless: ""
|
||||
*fr_CA.PageRegion A4/French Canadian A4: ""
|
||||
*fr_CA.PageRegion Env10/French Canadian #10 Envelope: ""
|
||||
|
||||
*DefaultImageableArea: Letter
|
||||
*ImageableArea Letter: "18 36 594 756"
|
||||
*ImageableArea Letter.Banner: "18 0 594 792"
|
||||
*ImageableArea Letter.Fullbleed: "0 0 612 792"
|
||||
*ImageableArea A4: "18 36 577 806"
|
||||
*ImageableArea Env10: "18 36 279 648"
|
||||
|
||||
*DefaultPaperDimension: Letter
|
||||
*PaperDimension Letter: "612 792"
|
||||
*PaperDimension Letter.Banner: "612 792"
|
||||
*PaperDimension Letter.Fullbleed: "612 792"
|
||||
*PaperDimension A4: "595 842"
|
||||
*PaperDimension Env10: "297 684"
|
||||
|
||||
+231
-10
@@ -15,22 +15,26 @@
|
||||
*
|
||||
* Contents:
|
||||
*
|
||||
* main() - Main entry.
|
||||
* test_pwg() - Test the PWG mapping functions.
|
||||
* main() - Main entry.
|
||||
* test_pagesize() - Test the PWG mapping functions.
|
||||
* test_pwg() - Test the PWG mapping functions.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Include necessary headers...
|
||||
*/
|
||||
|
||||
#include "pwg-private.h"
|
||||
#include "ppd-private.h"
|
||||
#include "file-private.h"
|
||||
|
||||
|
||||
/*
|
||||
* Local functions...
|
||||
*/
|
||||
|
||||
static int test_pwg(_pwg_t *pwg);
|
||||
static int test_pwg(_pwg_t *pwg, ppd_file_t *ppd);
|
||||
static int test_pagesize(_pwg_t *pwg, ppd_file_t *ppd,
|
||||
const char *ppdsize);
|
||||
|
||||
|
||||
/*
|
||||
@@ -50,13 +54,13 @@ main(int argc, /* I - Number of command-line args */
|
||||
|
||||
status = 0;
|
||||
|
||||
if (argc != 2)
|
||||
if (argc < 2 || argc > 3)
|
||||
{
|
||||
puts("Usage: ./testpwg filename.ppd");
|
||||
puts("Usage: ./testpwg filename.ppd [jobfile]");
|
||||
return (1);
|
||||
}
|
||||
else
|
||||
ppdfile = argv[1];
|
||||
|
||||
ppdfile = argv[1];
|
||||
|
||||
printf("ppdOpenFile(%s): ", ppdfile);
|
||||
if ((ppd = ppdOpenFile(ppdfile)) == NULL)
|
||||
@@ -83,7 +87,59 @@ main(int argc, /* I - Number of command-line args */
|
||||
else
|
||||
{
|
||||
puts("PASS");
|
||||
status += test_pwg(pwg);
|
||||
status += test_pwg(pwg, ppd);
|
||||
|
||||
if (argc == 3)
|
||||
{
|
||||
/*
|
||||
* Test PageSize mapping code.
|
||||
*/
|
||||
|
||||
int fd; /* Job file descriptor */
|
||||
const char *pagesize; /* PageSize value */
|
||||
ipp_t *job; /* Job attributes */
|
||||
ipp_attribute_t *media; /* Media attribute */
|
||||
|
||||
if ((fd = open(argv[2], O_RDONLY)) >= 0)
|
||||
{
|
||||
job = ippNew();
|
||||
ippReadFile(fd, job);
|
||||
close(fd);
|
||||
|
||||
if ((media = ippFindAttribute(job, "media", IPP_TAG_ZERO)) != NULL &&
|
||||
media->value_tag != IPP_TAG_NAME &&
|
||||
media->value_tag != IPP_TAG_KEYWORD)
|
||||
media = NULL;
|
||||
|
||||
if (media)
|
||||
printf("_pwgGetPageSize(media=%s): ", media->values[0].string.text);
|
||||
else
|
||||
fputs("_pwgGetPageSize(media-col): ", stdout);
|
||||
|
||||
fflush(stdout);
|
||||
|
||||
if ((pagesize = _pwgGetPageSize(pwg, job, NULL, NULL)) == NULL)
|
||||
{
|
||||
puts("FAIL (Not Found)");
|
||||
status = 1;
|
||||
}
|
||||
else if (media && strcasecmp(pagesize, media->values[0].string.text))
|
||||
{
|
||||
printf("FAIL (Got \"%s\", Expected \"%s\")\n", pagesize,
|
||||
media->values[0].string.text);
|
||||
status = 1;
|
||||
}
|
||||
else
|
||||
printf("PASS (%s)\n", pagesize);
|
||||
|
||||
ippDelete(job);
|
||||
}
|
||||
else
|
||||
{
|
||||
perror(argv[2]);
|
||||
status = 1;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* _pwgDestroy should never fail...
|
||||
@@ -94,6 +150,101 @@ main(int argc, /* I - Number of command-line args */
|
||||
puts("PASS");
|
||||
}
|
||||
|
||||
fputs("_pwgMediaForPWG(\"iso_a4_210x297mm\"): ", stdout);
|
||||
if ((pwgmedia = _pwgMediaForPWG("iso_a4_210x297mm")) == NULL)
|
||||
{
|
||||
puts("FAIL (not found)");
|
||||
status ++;
|
||||
}
|
||||
else if (strcmp(pwgmedia->pwg, "iso_a4_210x297mm"))
|
||||
{
|
||||
printf("FAIL (%s)\n", pwgmedia->pwg);
|
||||
status ++;
|
||||
}
|
||||
else if (pwgmedia->width != 21000 || pwgmedia->length != 29700)
|
||||
{
|
||||
printf("FAIL (%dx%d)\n", pwgmedia->width, pwgmedia->length);
|
||||
status ++;
|
||||
}
|
||||
else
|
||||
puts("PASS");
|
||||
|
||||
fputs("_pwgMediaForLegacy(\"na-letter\"): ", stdout);
|
||||
if ((pwgmedia = _pwgMediaForLegacy("na-letter")) == NULL)
|
||||
{
|
||||
puts("FAIL (not found)");
|
||||
status ++;
|
||||
}
|
||||
else if (strcmp(pwgmedia->pwg, "na_letter_8.5x11in"))
|
||||
{
|
||||
printf("FAIL (%s)\n", pwgmedia->pwg);
|
||||
status ++;
|
||||
}
|
||||
else if (pwgmedia->width != 21590 || pwgmedia->length != 27940)
|
||||
{
|
||||
printf("FAIL (%dx%d)\n", pwgmedia->width, pwgmedia->length);
|
||||
status ++;
|
||||
}
|
||||
else
|
||||
puts("PASS");
|
||||
|
||||
fputs("_pwgMediaForPPD(\"4x6\"): ", stdout);
|
||||
if ((pwgmedia = _pwgMediaForPPD("4x6")) == NULL)
|
||||
{
|
||||
puts("FAIL (not found)");
|
||||
status ++;
|
||||
}
|
||||
else if (strcmp(pwgmedia->pwg, "na_index-4x6_4x6in"))
|
||||
{
|
||||
printf("FAIL (%s)\n", pwgmedia->pwg);
|
||||
status ++;
|
||||
}
|
||||
else if (pwgmedia->width != 10160 || pwgmedia->length != 15240)
|
||||
{
|
||||
printf("FAIL (%dx%d)\n", pwgmedia->width, pwgmedia->length);
|
||||
status ++;
|
||||
}
|
||||
else
|
||||
puts("PASS");
|
||||
|
||||
fputs("_pwgMediaForPPD(\"10x15cm\"): ", stdout);
|
||||
if ((pwgmedia = _pwgMediaForPPD("10x15cm")) == NULL)
|
||||
{
|
||||
puts("FAIL (not found)");
|
||||
status ++;
|
||||
}
|
||||
else if (strcmp(pwgmedia->pwg, "om_100x150mm_100x150mm"))
|
||||
{
|
||||
printf("FAIL (%s)\n", pwgmedia->pwg);
|
||||
status ++;
|
||||
}
|
||||
else if (pwgmedia->width != 10000 || pwgmedia->length != 15000)
|
||||
{
|
||||
printf("FAIL (%dx%d)\n", pwgmedia->width, pwgmedia->length);
|
||||
status ++;
|
||||
}
|
||||
else
|
||||
puts("PASS");
|
||||
|
||||
fputs("_pwgMediaForPPD(\"Custom.10x15cm\"): ", stdout);
|
||||
if ((pwgmedia = _pwgMediaForPPD("Custom.10x15cm")) == NULL)
|
||||
{
|
||||
puts("FAIL (not found)");
|
||||
status ++;
|
||||
}
|
||||
else if (strcmp(pwgmedia->pwg, "custom_10x15cm_100x150mm"))
|
||||
{
|
||||
printf("FAIL (%s)\n", pwgmedia->pwg);
|
||||
status ++;
|
||||
}
|
||||
else if (pwgmedia->width != 10000 || pwgmedia->length != 15000)
|
||||
{
|
||||
printf("FAIL (%dx%d)\n", pwgmedia->width, pwgmedia->length);
|
||||
status ++;
|
||||
}
|
||||
else
|
||||
puts("PASS");
|
||||
|
||||
fputs("_pwgMediaForSize(29700, 42000): ", stdout);
|
||||
if ((pwgmedia = _pwgMediaForSize(29700, 42000)) == NULL)
|
||||
{
|
||||
@@ -112,12 +263,71 @@ main(int argc, /* I - Number of command-line args */
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'test_pagesize()' - Test the PWG mapping functions.
|
||||
*/
|
||||
|
||||
static int /* O - 1 on failure, 0 on success */
|
||||
test_pagesize(_pwg_t *pwg, /* I - PWG mapping data */
|
||||
ppd_file_t *ppd, /* I - PPD file */
|
||||
const char *ppdsize) /* I - PPD page size */
|
||||
{
|
||||
int status = 0; /* Return status */
|
||||
ipp_t *job; /* Job attributes */
|
||||
const char *pagesize; /* PageSize value */
|
||||
|
||||
|
||||
if (ppdPageSize(ppd, ppdsize))
|
||||
{
|
||||
printf("_pwgGetPageSize(keyword=%s): ", ppdsize);
|
||||
fflush(stdout);
|
||||
|
||||
if ((pagesize = _pwgGetPageSize(pwg, NULL, ppdsize, NULL)) == NULL)
|
||||
{
|
||||
puts("FAIL (Not Found)");
|
||||
status = 1;
|
||||
}
|
||||
else if (strcasecmp(pagesize, ppdsize))
|
||||
{
|
||||
printf("FAIL (Got \"%s\", Expected \"%s\")\n", pagesize, ppdsize);
|
||||
status = 1;
|
||||
}
|
||||
else
|
||||
puts("PASS");
|
||||
|
||||
job = ippNew();
|
||||
ippAddString(job, IPP_TAG_JOB, IPP_TAG_KEYWORD, "media", NULL, ppdsize);
|
||||
|
||||
printf("_pwgGetPageSize(media=%s): ", ppdsize);
|
||||
fflush(stdout);
|
||||
|
||||
if ((pagesize = _pwgGetPageSize(pwg, job, NULL, NULL)) == NULL)
|
||||
{
|
||||
puts("FAIL (Not Found)");
|
||||
status = 1;
|
||||
}
|
||||
else if (strcasecmp(pagesize, ppdsize))
|
||||
{
|
||||
printf("FAIL (Got \"%s\", Expected \"%s\")\n", pagesize, ppdsize);
|
||||
status = 1;
|
||||
}
|
||||
else
|
||||
puts("PASS");
|
||||
|
||||
ippDelete(job);
|
||||
}
|
||||
|
||||
return (status);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'test_pwg()' - Test the PWG mapping functions.
|
||||
*/
|
||||
|
||||
static int /* O - 1 on failure, 0 on success */
|
||||
test_pwg(_pwg_t *pwg) /* I - PWG mapping data */
|
||||
test_pwg(_pwg_t *pwg, /* I - PWG mapping data */
|
||||
ppd_file_t *ppd) /* I - PPD file */
|
||||
{
|
||||
int i, /* Looping var */
|
||||
status = 0; /* Return status */
|
||||
@@ -263,8 +473,19 @@ test_pwg(_pwg_t *pwg) /* I - PWG mapping data */
|
||||
|
||||
if (!status)
|
||||
puts("PASS");
|
||||
|
||||
_pwgDestroy(pwg2);
|
||||
}
|
||||
|
||||
/*
|
||||
* Test PageSize mapping code...
|
||||
*/
|
||||
|
||||
status += test_pagesize(pwg, ppd, "Letter");
|
||||
status += test_pagesize(pwg, ppd, "na-letter");
|
||||
status += test_pagesize(pwg, ppd, "A4");
|
||||
status += test_pagesize(pwg, ppd, "iso-a4");
|
||||
|
||||
return (status);
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -28,6 +28,7 @@ WEBIMAGES = \
|
||||
images/color-wheel.png \
|
||||
images/cups.png \
|
||||
images/cups-icon.png \
|
||||
images/generic.png \
|
||||
images/left.gif \
|
||||
images/right.gif \
|
||||
images/sel.gif \
|
||||
@@ -69,7 +70,6 @@ HELPFILES = \
|
||||
help/man-cupsenable.html \
|
||||
help/man-cupstestdsc.html \
|
||||
help/man-cupstestppd.html \
|
||||
help/man-drv.html \
|
||||
help/man-filter.html \
|
||||
help/man-lp.html \
|
||||
help/man-lpadmin.html \
|
||||
|
||||
@@ -338,7 +338,7 @@ div.contents ul.subcontents li {
|
||||
<body>
|
||||
<div class='body'>
|
||||
<!--
|
||||
"$Id: api-filter.html 9121 2010-04-23 18:57:00Z mike $"
|
||||
"$Id: api-filter.html 9283 2010-08-31 18:07:49Z mike $"
|
||||
|
||||
Filter and backend programming header for the Common UNIX Printing System
|
||||
(CUPS).
|
||||
@@ -375,7 +375,7 @@ div.contents ul.subcontents li {
|
||||
Programming: <a href='api-raster.html' target='_top'>Raster API</a><br>
|
||||
Programming: <a href='postscript-driver.html' target='_top'>Developing PostScript Printer Drivers</a><br>
|
||||
Programming: <a href='raster-driver.html' target='_top'>Developing Raster Printer Drivers</a><br>
|
||||
Specifications: <a href='spec-design' target='_top'>CUPS Design Description</a></td>
|
||||
Specifications: <a href='spec-design.html' target='_top'>CUPS Design Description</a></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
@@ -421,7 +421,7 @@ div.contents ul.subcontents li {
|
||||
<li><a href="#cups_sc_status_e" title="Response status codes">cups_sc_status_e</a></li>
|
||||
</ul></li>
|
||||
<!--
|
||||
"$Id: api-filter.html 9121 2010-04-23 18:57:00Z mike $"
|
||||
"$Id: api-filter.html 9283 2010-08-31 18:07:49Z mike $"
|
||||
|
||||
Filter and backend programming introduction for the Common UNIX Printing
|
||||
System (CUPS).
|
||||
|
||||
@@ -338,7 +338,7 @@ div.contents ul.subcontents li {
|
||||
<body>
|
||||
<div class='body'>
|
||||
<!--
|
||||
"$Id: api-httpipp.html 9121 2010-04-23 18:57:00Z mike $"
|
||||
"$Id: api-httpipp.html 9283 2010-08-31 18:07:49Z mike $"
|
||||
|
||||
HTTP and IPP API header for the Common UNIX Printing System (CUPS).
|
||||
|
||||
@@ -588,7 +588,7 @@ are server-oriented...">http_state_e</a></li>
|
||||
<li><a href="#ipp_tag_e" title="Format tags for attributes">ipp_tag_e</a></li>
|
||||
</ul></li>
|
||||
<!--
|
||||
"$Id: api-httpipp.html 9121 2010-04-23 18:57:00Z mike $"
|
||||
"$Id: api-httpipp.html 9283 2010-08-31 18:07:49Z mike $"
|
||||
|
||||
HTTP and IPP API introduction for the Common UNIX Printing System (CUPS).
|
||||
|
||||
@@ -3647,7 +3647,7 @@ are server-oriented...</p>
|
||||
<dt>HTTP_ACCEPTED </dt>
|
||||
<dd class="description">DELETE command was successful</dd>
|
||||
<dt>HTTP_AUTHORIZATION_CANCELED </dt>
|
||||
<dd class="description">User cancelled authorization</dd>
|
||||
<dd class="description">User canceled authorization</dd>
|
||||
<dt>HTTP_BAD_GATEWAY </dt>
|
||||
<dd class="description">Bad gateway</dd>
|
||||
<dt>HTTP_BAD_REQUEST </dt>
|
||||
|
||||
+63
-28
@@ -338,7 +338,7 @@ div.contents ul.subcontents li {
|
||||
<body>
|
||||
<div class='body'>
|
||||
<!--
|
||||
"$Id: api-raster.html 8653 2009-05-16 23:53:28Z mike $"
|
||||
"$Id: api-raster.html 9283 2010-08-31 18:07:49Z mike $"
|
||||
|
||||
Raster API header for the Common UNIX Printing System (CUPS).
|
||||
|
||||
@@ -429,7 +429,7 @@ page header structure.">cupsRasterWriteHeader2</a></li>
|
||||
<li><a href="#cups_orient_e" title="Orientation attribute values">cups_orient_e</a></li>
|
||||
</ul></li>
|
||||
<!--
|
||||
"$Id: api-raster.html 8653 2009-05-16 23:53:28Z mike $"
|
||||
"$Id: api-raster.html 9283 2010-08-31 18:07:49Z mike $"
|
||||
|
||||
Raster API introduction for the Common UNIX Printing System (CUPS).
|
||||
|
||||
@@ -1186,20 +1186,52 @@ factor not applied) </dd>
|
||||
<p class="description">cupsColorSpace attribute values</p>
|
||||
<h4 class="constants">Constants</h4>
|
||||
<dl>
|
||||
<dt>CUPS_CSPACE_ADOBERGB <span class="info"> CUPS 1.4.5 </span></dt>
|
||||
<dd class="description">Red, green, blue (Adobe RGB) </dd>
|
||||
<dt>CUPS_CSPACE_CIELab <span class="info"> CUPS 1.1.19/Mac OS X 10.3 </span></dt>
|
||||
<dd class="description">CIE Lab </dd>
|
||||
<dt>CUPS_CSPACE_CIEXYZ <span class="info"> CUPS 1.1.19/Mac OS X 10.3 </span></dt>
|
||||
<dd class="description">CIE XYZ </dd>
|
||||
<dt>CUPS_CSPACE_CMY </dt>
|
||||
<dd class="description">Cyan, magenta, yellow</dd>
|
||||
<dd class="description">Cyan, magenta, yellow (DeviceCMY)</dd>
|
||||
<dt>CUPS_CSPACE_CMYK </dt>
|
||||
<dd class="description">Cyan, magenta, yellow, black</dd>
|
||||
<dt>CUPS_CSPACE_GMCK </dt>
|
||||
<dd class="description">Gold, magenta, yellow, black</dd>
|
||||
<dt>CUPS_CSPACE_GMCS </dt>
|
||||
<dd class="description">Gold, magenta, yellow, silver</dd>
|
||||
<dt>CUPS_CSPACE_GOLD </dt>
|
||||
<dd class="description">Gold foil</dd>
|
||||
<dd class="description">Cyan, magenta, yellow, black (DeviceCMYK)</dd>
|
||||
<dt>CUPS_CSPACE_DEVICE1 <span class="info"> CUPS 1.4.5 </span></dt>
|
||||
<dd class="description">DeviceN, 1 color </dd>
|
||||
<dt>CUPS_CSPACE_DEVICE2 <span class="info"> CUPS 1.4.5 </span></dt>
|
||||
<dd class="description">DeviceN, 2 colors </dd>
|
||||
<dt>CUPS_CSPACE_DEVICE3 <span class="info"> CUPS 1.4.5 </span></dt>
|
||||
<dd class="description">DeviceN, 3 colors </dd>
|
||||
<dt>CUPS_CSPACE_DEVICE4 <span class="info"> CUPS 1.4.5 </span></dt>
|
||||
<dd class="description">DeviceN, 4 colors </dd>
|
||||
<dt>CUPS_CSPACE_DEVICE5 <span class="info"> CUPS 1.4.5 </span></dt>
|
||||
<dd class="description">DeviceN, 5 colors </dd>
|
||||
<dt>CUPS_CSPACE_DEVICE6 <span class="info"> CUPS 1.4.5 </span></dt>
|
||||
<dd class="description">DeviceN, 6 colors </dd>
|
||||
<dt>CUPS_CSPACE_DEVICE7 <span class="info"> CUPS 1.4.5 </span></dt>
|
||||
<dd class="description">DeviceN, 7 colors </dd>
|
||||
<dt>CUPS_CSPACE_DEVICE8 <span class="info"> CUPS 1.4.5 </span></dt>
|
||||
<dd class="description">DeviceN, 8 colors </dd>
|
||||
<dt>CUPS_CSPACE_DEVICE9 <span class="info"> CUPS 1.4.5 </span></dt>
|
||||
<dd class="description">DeviceN, 9 colors </dd>
|
||||
<dt>CUPS_CSPACE_DEVICEA <span class="info"> CUPS 1.4.5 </span></dt>
|
||||
<dd class="description">DeviceN, 10 colors </dd>
|
||||
<dt>CUPS_CSPACE_DEVICEB <span class="info"> CUPS 1.4.5 </span></dt>
|
||||
<dd class="description">DeviceN, 11 colors </dd>
|
||||
<dt>CUPS_CSPACE_DEVICEC <span class="info"> CUPS 1.4.5 </span></dt>
|
||||
<dd class="description">DeviceN, 12 colors </dd>
|
||||
<dt>CUPS_CSPACE_DEVICED <span class="info"> CUPS 1.4.5 </span></dt>
|
||||
<dd class="description">DeviceN, 13 colors </dd>
|
||||
<dt>CUPS_CSPACE_DEVICEE <span class="info"> CUPS 1.4.5 </span></dt>
|
||||
<dd class="description">DeviceN, 14 colors </dd>
|
||||
<dt>CUPS_CSPACE_DEVICEF <span class="info"> CUPS 1.4.5 </span></dt>
|
||||
<dd class="description">DeviceN, 15 colors </dd>
|
||||
<dt>CUPS_CSPACE_GMCK <span class="info"> DEPRECATED </span></dt>
|
||||
<dd class="description">Gold, magenta, yellow, black </dd>
|
||||
<dt>CUPS_CSPACE_GMCS <span class="info"> DEPRECATED </span></dt>
|
||||
<dd class="description">Gold, magenta, yellow, silver </dd>
|
||||
<dt>CUPS_CSPACE_GOLD <span class="info"> DEPRECATED </span></dt>
|
||||
<dd class="description">Gold foil </dd>
|
||||
<dt>CUPS_CSPACE_ICC1 <span class="info"> CUPS 1.1.19/Mac OS X 10.3 </span></dt>
|
||||
<dd class="description">ICC-based, 1 color </dd>
|
||||
<dt>CUPS_CSPACE_ICC2 <span class="info"> CUPS 1.1.19/Mac OS X 10.3 </span></dt>
|
||||
@@ -1231,28 +1263,31 @@ factor not applied) </dd>
|
||||
<dt>CUPS_CSPACE_ICCF <span class="info"> CUPS 1.1.19/Mac OS X 10.3 </span></dt>
|
||||
<dd class="description">ICC-based, 15 colors </dd>
|
||||
<dt>CUPS_CSPACE_K </dt>
|
||||
<dd class="description">Black</dd>
|
||||
<dt>CUPS_CSPACE_KCMY </dt>
|
||||
<dd class="description">Black, cyan, magenta, yellow</dd>
|
||||
<dt>CUPS_CSPACE_KCMYcm </dt>
|
||||
<dd class="description">Black, cyan, magenta, yellow, *
|
||||
light-cyan, light-magenta</dd>
|
||||
<dd class="description">Black (DeviceK)</dd>
|
||||
<dt>CUPS_CSPACE_KCMY <span class="info"> DEPRECATED </span></dt>
|
||||
<dd class="description">Black, cyan, magenta, yellow </dd>
|
||||
<dt>CUPS_CSPACE_KCMYcm <span class="info"> DEPRECATED </span></dt>
|
||||
<dd class="description">Black, cyan, magenta, yellow, light-cyan, light-magenta </dd>
|
||||
<dt>CUPS_CSPACE_RGB </dt>
|
||||
<dd class="description">Red, green, blue</dd>
|
||||
<dd class="description">Red, green, blue (DeviceRGB, sRGB by default)</dd>
|
||||
<dt>CUPS_CSPACE_RGBA </dt>
|
||||
<dd class="description">Red, green, blue, alpha</dd>
|
||||
<dd class="description">Red, green, blue, alpha (DeviceRGB, sRGB by default)</dd>
|
||||
<dt>CUPS_CSPACE_RGBW <span class="info"> CUPS 1.2/Mac OS X 10.5 </span></dt>
|
||||
<dd class="description">Red, green, blue, white </dd>
|
||||
<dt>CUPS_CSPACE_SILVER </dt>
|
||||
<dd class="description">Silver foil</dd>
|
||||
<dd class="description">Red, green, blue, white (DeviceRGB, sRGB by default) </dd>
|
||||
<dt>CUPS_CSPACE_SILVER <span class="info"> DEPRECATED </span></dt>
|
||||
<dd class="description">Silver foil </dd>
|
||||
<dt>CUPS_CSPACE_SRGB <span class="info"> CUPS 1.4.5 </span></dt>
|
||||
<dd class="description">Red, green, blue (sRGB) </dd>
|
||||
<dt>CUPS_CSPACE_SW <span class="info"> CUPS 1.4.5 </span></dt>
|
||||
<dd class="description">Luminance (gamma 2.2) </dd>
|
||||
<dt>CUPS_CSPACE_W </dt>
|
||||
<dd class="description">Luminance</dd>
|
||||
<dt>CUPS_CSPACE_WHITE </dt>
|
||||
<dd class="description">White ink (as black)</dd>
|
||||
<dt>CUPS_CSPACE_YMC </dt>
|
||||
<dd class="description">Yellow, magenta, cyan</dd>
|
||||
<dt>CUPS_CSPACE_YMCK </dt>
|
||||
<dd class="description">Yellow, magenta, cyan, black</dd>
|
||||
<dd class="description">Luminance (DeviceGray, gamma 2.2 by default)</dd>
|
||||
<dt>CUPS_CSPACE_WHITE <span class="info"> DEPRECATED </span></dt>
|
||||
<dd class="description">White ink (as black) </dd>
|
||||
<dt>CUPS_CSPACE_YMC <span class="info"> DEPRECATED </span></dt>
|
||||
<dd class="description">Yellow, magenta, cyan </dd>
|
||||
<dt>CUPS_CSPACE_YMCK <span class="info"> DEPRECATED </span></dt>
|
||||
<dd class="description">Yellow, magenta, cyan, black </dd>
|
||||
</dl>
|
||||
<h3 class="enumeration"><a name="cups_cut_e">cups_cut_e</a></h3>
|
||||
<p class="description">CutMedia attribute values</p>
|
||||
|
||||
@@ -113,7 +113,7 @@ converted to just "user" for purposes of user and group checks.</P>
|
||||
|
||||
<P>In order to support printing to a shared printer, CUPS has to ask the KDC
|
||||
for a copy of your credentials (this is called delegation) that can be sent to
|
||||
the remote server for authenticatation. Delegation only works when the system
|
||||
the remote server for authentication. Delegation only works when the system
|
||||
has a stable hostname which maps to the current address of the system, which
|
||||
is why you need a static IP address or DHCP that updates the DNS entry for your
|
||||
system.</P>
|
||||
|
||||
@@ -2931,23 +2931,23 @@ SetEnv MY_ENV_VAR foo
|
||||
variable that should be passed to child processes.</P>
|
||||
|
||||
|
||||
<H2 CLASS="title"><A NAME="SSLOptions">SSLOptions</A></H2>
|
||||
<H2 CLASS="title"><A NAME="SSLListen">SSLListen</A></H2>
|
||||
|
||||
<H3>Examples</H3>
|
||||
|
||||
<PRE CLASS="command">
|
||||
SSLOptions 127.0.0.1:443
|
||||
SSLOptions 192.0.2.1:443
|
||||
SSLListen 127.0.0.1:443
|
||||
SSLListen 192.0.2.1:443
|
||||
</PRE>
|
||||
|
||||
<H3>Description</H3>
|
||||
|
||||
<P>The <CODE>SSLOptions</CODE> directive specifies a network
|
||||
<P>The <CODE>SSLListen</CODE> directive specifies a network
|
||||
address and port to listen for secure connections. Multiple
|
||||
<CODE>SSLOptions</CODE> directives can be provided to listen on
|
||||
<CODE>SSLListen</CODE> directives can be provided to listen on
|
||||
multiple addresses.</P>
|
||||
|
||||
<P>The <CODE>SSLOptions</CODE> directive is similar to the <A
|
||||
<P>The <CODE>SSLListen</CODE> directive is similar to the <A
|
||||
HREF="#SSLPort"><CODE>SSLPort</CODE></A> directive but allows you
|
||||
to restrict access to specific interfaces or networks.</P>
|
||||
|
||||
|
||||
+70
-22
@@ -8,11 +8,11 @@
|
||||
</head>
|
||||
<body>
|
||||
<!--
|
||||
"$Id: spec-ppd.html 9143 2010-05-21 15:36:30Z mike $"
|
||||
"$Id: spec-ppd.html 9406 2010-12-08 07:23:22Z mike $"
|
||||
|
||||
CUPS PPD extensions specification for the Common UNIX Printing System (CUPS).
|
||||
CUPS PPD extensions specification for CUPS.
|
||||
|
||||
Copyright 2007-2009 by Apple Inc.
|
||||
Copyright 2007-2010 by Apple Inc.
|
||||
Copyright 1997-2007 by Easy Software Products.
|
||||
|
||||
These coded instructions, statements, and computer programs are the
|
||||
@@ -438,7 +438,7 @@ choice followed by testing each option choice to resolve the conflict.</p>
|
||||
|
||||
<h3><span class='info'>CUPS 1.4/Mac OS X 10.6</span><a name='cupsUIResolver'>cupsUIResolver</a></h3>
|
||||
|
||||
<p class='summary'>*cupsUIResolution resolver: "*Keyword1 OptionKeyword1 *Keyword2 OptionKeyword2 ..."</p>
|
||||
<p class='summary'>*cupsUIResolver resolver: "*Keyword1 OptionKeyword1 *Keyword2 OptionKeyword2 ..."</p>
|
||||
|
||||
<p>Specifies two or more options to mark/select to resolve a constraint. The
|
||||
"resolver" string identifies a particular action to take for one or more
|
||||
@@ -1566,6 +1566,31 @@ before the filter that accepts the given MIME type.</p>
|
||||
*cupsPreFilter: "image/png 0 mypngprefilter"
|
||||
</pre>
|
||||
|
||||
|
||||
<h3><span class='info'>CUPS 1.5</span><a name='cupsPrintQuality'>cupsPrintQuality</a></h3>
|
||||
|
||||
<p class='summary'>*cupsPrintQuality keyword/text: "code"</p>
|
||||
|
||||
<p>This UI keyword defines standard print qualities that directly map from the IPP "print-quality" job template attribute. Standard keyword values are "Draft", "Normal", and "High" which are mapped from the IPP "print-quality" values 3, 4, and 5 respectively. Each <code>cupsPrintQuality</code> option typically sets output mode and resolution parameters in the page device dictionary, eliminating the need for separate (and sometimes confusing) output mode and resolution options.</p>
|
||||
|
||||
<blockquote><b>Note:</b>
|
||||
|
||||
<p>Unlike all of the other keywords defined in this document, <code>cupsPrintQuality</code> is a UI keyword that MUST be enclosed inside the PPD <code>OpenUI</code> and <code>CloseUI</code> keywords.</p>
|
||||
|
||||
</blockquote>
|
||||
|
||||
<p>Examples:</p>
|
||||
|
||||
<pre class='command'>
|
||||
*OpenUI *cupsPrintQuality/Print Quality: PickOne
|
||||
*OrderDependency: 10 AnySetup *cupsPrintQuality
|
||||
*DefaultcupsPrintQuality: Normal
|
||||
*cupsPrintQuality Draft/Draft: "code"
|
||||
*cupsPrintQuality Normal/Normal: "code"
|
||||
*cupsPrintQuality High/Photo: "code"
|
||||
*CloseUI: *cupsPrintQuality
|
||||
</pre>
|
||||
|
||||
<h3><span class='info'>CUPS 1.4/Mac OS X 10.6</span><a name='cupsSNMPSupplies'>cupsSNMPSupplies</a></h3>
|
||||
|
||||
<p class='summary'>*cupsSNMPSupplies: boolean</p>
|
||||
@@ -1775,39 +1800,51 @@ Technical Note TN2144</a> for more information.</p>
|
||||
in the print dialog of applications (such as iPhoto) that set the job
|
||||
style hint to <tt>NSPrintPhotoJobStyleHint</tt>. Each preset maps to one or
|
||||
more pairs of PPD options and choices as well as providing key/value data for
|
||||
the application. The following preset names are currently defined:</p>
|
||||
the application. The following standard preset names are currently defined:</p>
|
||||
|
||||
<ul>
|
||||
|
||||
<li><code>Photo_with_Paper_Auto-Detect</code>; Photo printing
|
||||
with paper auto-detect</li>
|
||||
<li><code>General_with_Paper_Auto-Detect</code>; Normal quality general printing with auto-detected media.</li>
|
||||
|
||||
<li><code>Photo_with_Paper_Auto-Detect_-_Fine</code>; Photo printing
|
||||
with paper auto-detect - fine</li>
|
||||
<li><code>General_with_Paper_Auto-Detect_-_Draft</code>; Draft quality general printing with auto-detected media.</li>
|
||||
|
||||
<li><code>Photo_on_Plain_Paper</code>; Photo printing on plain paper</li>
|
||||
<li><code>General_on_Plain_Paper</code>; Normal quality general printing on plain paper.</li>
|
||||
|
||||
<li><code>Photo_on_Plain_Paper_-_Fine</code>; Photo printing on plain
|
||||
paper - fine</li>
|
||||
<li><code>General_on_Plain_Paper_-_Draft</code>; Draft quality general printing on plain paper.</li>
|
||||
|
||||
<li><code>Photo_on_Photo_Paper</code>; Photo printing on photo paper</li>
|
||||
<li><code>Photo_with_Paper_Auto-Detect</code>; Normal quality photo printing with auto-detected media.</li>
|
||||
|
||||
<li><code>Photo_on_Photo_Paper_-_Fine</code>; Photo printing on photo
|
||||
paper - fine</li>
|
||||
<li><code>Photo_with_Paper_Auto-Detect_-_Fine</code>; High quality photo printing with auto-detected media.</li>
|
||||
|
||||
<li><code>Photo_on_Matte_Paper</code>; Photo printing on matte paper</li>
|
||||
<li><code>Photo_on_Plain_Paper</code>; Normal quality photo printing on plain paper.</li>
|
||||
|
||||
<li><code>Photo_on_Matte_Paper_-_Fine</code>; Photo printing on matte
|
||||
paper - fine</li>
|
||||
<li><code>Photo_on_Plain_Paper_-_Fine</code>; High quality photo printing on plain paper.</li>
|
||||
|
||||
<li><code>Photo_on_Photo_Paper</code>; Normal quality photo printing on glossy photo paper.</li>
|
||||
|
||||
<li><code>Photo_on_Photo_Paper_-_Fine</code>; High quality photo printing on glossy photo paper.</li>
|
||||
|
||||
<li><code>Photo_on_Matte_Paper</code>; Normal quality photo printing on matte paper.</li>
|
||||
|
||||
<li><code>Photo_on_Matte_Paper_-_Fine</code>; High quality photo printing on matte paper.</li>
|
||||
|
||||
</ul>
|
||||
|
||||
<p>The value string consists of pairs of keywords, either an option name and
|
||||
choice (*MainKeyword OptionKeyword) or a preset identifier and value
|
||||
(com.apple.print.preset.foo value). Preset identifiers and their supported
|
||||
values are documented in "<a
|
||||
href='http://developer.apple.com/mac/library/documentation/Printing/Conceptual/PresetDraft/presets_intro/presets_intro.html'
|
||||
>Creating Printing Presets for iPhoto: Printing Presets File Format</a>".</p>
|
||||
(com.apple.print.preset.foo value). The following preset identifiers are currently used:</p>
|
||||
|
||||
<ul>
|
||||
|
||||
<li><code>com.apple.print.preset.graphicsType</code>; specifies the type of printing used for this printing - "General" for general purpose printing and "Photo" for photo printing.</li>
|
||||
|
||||
<li><code>com.apple.print.preset.media-front-coating</code>; specifies the media type selected by this preset - "none" (plain paper), "glossy", "high-gloss", "semi-gloss", "satin", "matte", and "autodetect".</li>
|
||||
|
||||
<li><code>com.apple.print.preset.output-mode</code>; specifies the output mode for this preset - "color" (default for color printers) or "monochrome" (grayscale, default for B&W printers).</li>
|
||||
|
||||
<li><code>com.apple.print.preset.quality</code>; specifies the overall print quality selected by this preset - "low" (draft), "mid" (normal), or "high".</li>
|
||||
|
||||
</ul>
|
||||
|
||||
<p>Presets, like options, can also be localized in multiple languages.</p>
|
||||
|
||||
@@ -1871,6 +1908,17 @@ the device.</p>
|
||||
|
||||
<h2 class='title'><a name='HISTORY'>Change History</a></h2>
|
||||
|
||||
<h3>Changes in CUPS 1.4.5</h3>
|
||||
|
||||
<ul>
|
||||
|
||||
<li>Added <a href='#cupsPrintQuality'><tt>cupsPrintQuality</tt></a> UI keyword.</li>
|
||||
|
||||
<li>Added new properties and values for the <a href='#APPrinterPreset'><tt>APPrinterPreset</tt></a> keyword.</li>
|
||||
|
||||
</ul>
|
||||
|
||||
|
||||
<h3>Changes in CUPS 1.4</h3>
|
||||
|
||||
<ul>
|
||||
|
||||
Arquivo binário não exibido.
|
Depois Largura: | Altura: | Tamanho: 16 KiB |
@@ -481,6 +481,7 @@ main(int argc, /* I - Number of command-line arguments */
|
||||
switch (header.cupsColorSpace)
|
||||
{
|
||||
case CUPS_CSPACE_W :
|
||||
case CUPS_CSPACE_SW :
|
||||
if (header.cupsBitsPerColor >= 8)
|
||||
{
|
||||
primary = CUPS_IMAGE_WHITE;
|
||||
@@ -493,10 +494,11 @@ main(int argc, /* I - Number of command-line arguments */
|
||||
}
|
||||
break;
|
||||
|
||||
default :
|
||||
case CUPS_CSPACE_RGB :
|
||||
case CUPS_CSPACE_RGBA :
|
||||
case CUPS_CSPACE_RGBW :
|
||||
case CUPS_CSPACE_SRGB :
|
||||
case CUPS_CSPACE_ADOBERGB :
|
||||
if (header.cupsBitsPerColor >= 8)
|
||||
{
|
||||
primary = CUPS_IMAGE_RGB;
|
||||
@@ -540,6 +542,42 @@ main(int argc, /* I - Number of command-line arguments */
|
||||
primary = CUPS_IMAGE_CMY;
|
||||
secondary = CUPS_IMAGE_CMY;
|
||||
break;
|
||||
|
||||
case CUPS_CSPACE_CIEXYZ :
|
||||
case CUPS_CSPACE_CIELab :
|
||||
case CUPS_CSPACE_ICC1 :
|
||||
case CUPS_CSPACE_ICC2 :
|
||||
case CUPS_CSPACE_ICC3 :
|
||||
case CUPS_CSPACE_ICC4 :
|
||||
case CUPS_CSPACE_ICC5 :
|
||||
case CUPS_CSPACE_ICC6 :
|
||||
case CUPS_CSPACE_ICC7 :
|
||||
case CUPS_CSPACE_ICC8 :
|
||||
case CUPS_CSPACE_ICC9 :
|
||||
case CUPS_CSPACE_ICCA :
|
||||
case CUPS_CSPACE_ICCB :
|
||||
case CUPS_CSPACE_ICCC :
|
||||
case CUPS_CSPACE_ICCD :
|
||||
case CUPS_CSPACE_ICCE :
|
||||
case CUPS_CSPACE_ICCF :
|
||||
case CUPS_CSPACE_DEVICE1 :
|
||||
case CUPS_CSPACE_DEVICE2 :
|
||||
case CUPS_CSPACE_DEVICE3 :
|
||||
case CUPS_CSPACE_DEVICE4 :
|
||||
case CUPS_CSPACE_DEVICE5 :
|
||||
case CUPS_CSPACE_DEVICE6 :
|
||||
case CUPS_CSPACE_DEVICE7 :
|
||||
case CUPS_CSPACE_DEVICE8 :
|
||||
case CUPS_CSPACE_DEVICE9 :
|
||||
case CUPS_CSPACE_DEVICEA :
|
||||
case CUPS_CSPACE_DEVICEB :
|
||||
case CUPS_CSPACE_DEVICEC :
|
||||
case CUPS_CSPACE_DEVICED :
|
||||
case CUPS_CSPACE_DEVICEE :
|
||||
case CUPS_CSPACE_DEVICEF :
|
||||
fprintf(stderr, "ERROR: Colorspace %d not supported.\n",
|
||||
header.cupsColorSpace);
|
||||
exit(1);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
+20
-8
@@ -2393,6 +2393,7 @@ set_pstops_options(
|
||||
ppd_attr_t *attr; /* PPD attribute */
|
||||
ppd_option_t *option; /* PPD option */
|
||||
ppd_choice_t *choice; /* PPD choice */
|
||||
const char *content_type; /* Original content type */
|
||||
|
||||
|
||||
/*
|
||||
@@ -2449,7 +2450,6 @@ set_pstops_options(
|
||||
if ((choice = ppdFindMarkedChoice(ppd, "PageSize")) != NULL)
|
||||
doc->page_size = choice->choice;
|
||||
|
||||
|
||||
/*
|
||||
* brightness
|
||||
*/
|
||||
@@ -2509,15 +2509,27 @@ set_pstops_options(
|
||||
doc->emit_jcl = 1;
|
||||
|
||||
/*
|
||||
* fitplot/fit-to-page
|
||||
* fitplot/fit-to-page/ipp-attribute-fidelity
|
||||
*
|
||||
* (Only for original PostScript content)
|
||||
*/
|
||||
|
||||
if ((val = cupsGetOption("fitplot", num_options, options)) != NULL &&
|
||||
!strcasecmp(val, "true"))
|
||||
doc->fitplot = 1;
|
||||
else if ((val = cupsGetOption("fit-to-page", num_options, options)) != NULL &&
|
||||
!strcasecmp(val, "true"))
|
||||
doc->fitplot = 1;
|
||||
if ((content_type = getenv("CONTENT_TYPE")) == NULL)
|
||||
content_type = "application/postscript";
|
||||
|
||||
if (!strcasecmp(content_type, "application/postscript"))
|
||||
{
|
||||
if ((val = cupsGetOption("fitplot", num_options, options)) != NULL &&
|
||||
!strcasecmp(val, "true"))
|
||||
doc->fitplot = 1;
|
||||
else if ((val = cupsGetOption("fit-to-page", num_options, options)) != NULL &&
|
||||
!strcasecmp(val, "true"))
|
||||
doc->fitplot = 1;
|
||||
else if ((val = cupsGetOption("ipp-attribute-fidelity", num_options,
|
||||
options)) != NULL &&
|
||||
!strcasecmp(val, "true"))
|
||||
doc->fitplot = 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* gamma
|
||||
|
||||
+24
-2
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
* "$Id$"
|
||||
*
|
||||
* Raster file routines for the Common UNIX Printing System (CUPS).
|
||||
* Raster file routines for CUPS.
|
||||
*
|
||||
* Copyright 2007-2008 by Apple Inc.
|
||||
* Copyright 2007-2010 by Apple Inc.
|
||||
* Copyright 1997-2006 by Easy Software Products.
|
||||
*
|
||||
* This file is part of the CUPS Imaging library.
|
||||
@@ -920,6 +920,7 @@ cups_raster_update(cups_raster_t *r) /* I - Raster stream */
|
||||
case CUPS_CSPACE_WHITE :
|
||||
case CUPS_CSPACE_GOLD :
|
||||
case CUPS_CSPACE_SILVER :
|
||||
case CUPS_CSPACE_SW :
|
||||
r->header.cupsNumColors = 1;
|
||||
break;
|
||||
|
||||
@@ -928,6 +929,8 @@ cups_raster_update(cups_raster_t *r) /* I - Raster stream */
|
||||
case CUPS_CSPACE_YMC :
|
||||
case CUPS_CSPACE_CIEXYZ :
|
||||
case CUPS_CSPACE_CIELab :
|
||||
case CUPS_CSPACE_SRGB :
|
||||
case CUPS_CSPACE_ADOBERGB :
|
||||
case CUPS_CSPACE_ICC1 :
|
||||
case CUPS_CSPACE_ICC2 :
|
||||
case CUPS_CSPACE_ICC3 :
|
||||
@@ -962,6 +965,25 @@ cups_raster_update(cups_raster_t *r) /* I - Raster stream */
|
||||
else
|
||||
r->header.cupsNumColors = 4;
|
||||
break;
|
||||
|
||||
case CUPS_CSPACE_DEVICE1 :
|
||||
case CUPS_CSPACE_DEVICE2 :
|
||||
case CUPS_CSPACE_DEVICE3 :
|
||||
case CUPS_CSPACE_DEVICE4 :
|
||||
case CUPS_CSPACE_DEVICE5 :
|
||||
case CUPS_CSPACE_DEVICE6 :
|
||||
case CUPS_CSPACE_DEVICE7 :
|
||||
case CUPS_CSPACE_DEVICE8 :
|
||||
case CUPS_CSPACE_DEVICE9 :
|
||||
case CUPS_CSPACE_DEVICEA :
|
||||
case CUPS_CSPACE_DEVICEB :
|
||||
case CUPS_CSPACE_DEVICEC :
|
||||
case CUPS_CSPACE_DEVICED :
|
||||
case CUPS_CSPACE_DEVICEE :
|
||||
case CUPS_CSPACE_DEVICEF :
|
||||
r->header.cupsNumColors = r->header.cupsColorSpace -
|
||||
CUPS_CSPACE_DEVICE1 + 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+4
-4
@@ -116,6 +116,10 @@
|
||||
type='service'
|
||||
version='1'>
|
||||
|
||||
<restarter>
|
||||
<service_fmri value='svc:/network/inetd:default' />
|
||||
</restarter>
|
||||
|
||||
<dependency
|
||||
name='filesystem_minimal'
|
||||
grouping='require_all'
|
||||
@@ -155,10 +159,6 @@
|
||||
timeout_seconds='60' />
|
||||
|
||||
<instance name='default' enabled='false' >
|
||||
<restarter>
|
||||
<service_fmri value='svc:/network/inetd:default' />
|
||||
</restarter>
|
||||
|
||||
<dependency
|
||||
name='cupsd'
|
||||
grouping='require_all'
|
||||
|
||||
@@ -47,7 +47,6 @@ MAN5 = classes.conf.$(MAN5EXT) \
|
||||
printers.conf.$(MAN5EXT) \
|
||||
subscriptions.conf.$(MAN5EXT)
|
||||
MAN7 = backend.$(MAN7EXT) \
|
||||
drv.$(MAN7EXT) \
|
||||
filter.$(MAN7EXT) \
|
||||
notifier.$(MAN7EXT)
|
||||
MAN8 = cupsaccept.$(MAN8EXT) \
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
.\"
|
||||
.\" "$Id$"
|
||||
.\"
|
||||
.\" drv man page for the Common UNIX Printing System.
|
||||
.\"
|
||||
.\" Copyright 2008-2009 by Apple Inc.
|
||||
.\"
|
||||
.\" These coded instructions, statements, and computer programs are the
|
||||
.\" property of Apple Inc. and are protected by Federal copyright
|
||||
.\" law. Distribution and use rights are outlined in the file "LICENSE.txt"
|
||||
.\" which should have been included with this file. If this file is
|
||||
.\" file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
.\"
|
||||
.TH drv 1 "CUPS" "9 March 2009" "Apple Inc."
|
||||
.SH NAME
|
||||
drv \- cups driver interface for ppd compiler files
|
||||
.SH SYNOPSIS
|
||||
.B drv list
|
||||
.br
|
||||
.B drv cat
|
||||
.I drv:///filename.drv/pcfilename
|
||||
.SH DESCRIPTION
|
||||
\fIdrv\fR lists and compiles PPDC source files installed in the
|
||||
@CUPS_DATADIR@/drv and (on Mac OS X) /Library/Printers/PPDs/Contents/Resources
|
||||
directories on behalf of the scheduler, \fIcupsd(8)\fR.
|
||||
.PP
|
||||
The first form of the command lists all of the PPD files that can be produced
|
||||
by the driver information files in the two directories.
|
||||
.PP
|
||||
The second form of the command compiles the requested PPD and sends it to the
|
||||
standard output.
|
||||
.SH SEE ALSO
|
||||
ppdc(1), ppdhtml(1), ppdi(1), ppdmerge(1), ppdpo(1), ppdcfile(5)
|
||||
.br
|
||||
http://localhost:631/help
|
||||
.SH COPYRIGHT
|
||||
Copyright 2008-2009 by Apple Inc.
|
||||
.\"
|
||||
.\" End of "$Id$".
|
||||
.\"
|
||||
+5
-6
@@ -1,9 +1,9 @@
|
||||
.\"
|
||||
.\" "$Id: lp.man 8421 2009-03-09 21:59:55Z mike $"
|
||||
.\" "$Id: lp.man 9282 2010-08-31 15:56:40Z mike $"
|
||||
.\"
|
||||
.\" lp man page for the Common UNIX Printing System (CUPS).
|
||||
.\"
|
||||
.\" Copyright 2007-2009 by Apple Inc.
|
||||
.\" Copyright 2007-2010 by Apple Inc.
|
||||
.\" Copyright 1997-2006 by Easy Software Products.
|
||||
.\"
|
||||
.\" These coded instructions, statements, and computer programs are the
|
||||
@@ -12,7 +12,7 @@
|
||||
.\" which should have been included with this file. If this file is
|
||||
.\" file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
.\"
|
||||
.TH lp 1 "CUPS" "17 November 2008" "Apple Inc."
|
||||
.TH lp 1 "CUPS" "31 August 2010" "Apple Inc."
|
||||
.SH NAME
|
||||
lp - print files
|
||||
.SH SYNOPSIS
|
||||
@@ -157,7 +157,6 @@ contain a list of numbers and ranges (#-#) separated by commas
|
||||
(e.g. 1,3-5,16). The page numbers refer to the output pages and
|
||||
not the document's original pages - options like "number-up" can
|
||||
affect the numbering of the pages.
|
||||
that are
|
||||
.SH COMMON JOB OPTIONS
|
||||
Aside from the printer-specific options reported by the
|
||||
\fIlpoptions(1)\fR command, the following generic options are
|
||||
@@ -258,7 +257,7 @@ is highest priority).
|
||||
.br
|
||||
http://localhost:631/help
|
||||
.SH COPYRIGHT
|
||||
Copyright 2007-2009 by Apple Inc.
|
||||
Copyright 2007-2010 by Apple Inc.
|
||||
.\"
|
||||
.\" End of "$Id: lp.man 8421 2009-03-09 21:59:55Z mike $".
|
||||
.\" End of "$Id: lp.man 9282 2010-08-31 15:56:40Z mike $".
|
||||
.\"
|
||||
|
||||
+27
-26
@@ -1,9 +1,9 @@
|
||||
.\"
|
||||
.\" "$Id: lpadmin.man 8421 2009-03-09 21:59:55Z mike $"
|
||||
.\" "$Id: lpadmin.man 9291 2010-09-01 15:51:59Z mike $"
|
||||
.\"
|
||||
.\" lpadmin man page for the Common UNIX Printing System (CUPS).
|
||||
.\"
|
||||
.\" Copyright 2007-2009 by Apple Inc.
|
||||
.\" Copyright 2007-2010 by Apple Inc.
|
||||
.\" Copyright 1997-2006 by Easy Software Products.
|
||||
.\"
|
||||
.\" These coded instructions, statements, and computer programs are the
|
||||
@@ -12,7 +12,7 @@
|
||||
.\" which should have been included with this file. If this file is
|
||||
.\" file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
.\"
|
||||
.TH lpadmin 8 "CUPS" "3 November 2008" "Apple Inc."
|
||||
.TH lpadmin 8 "CUPS" "1 September 2010" "Apple Inc."
|
||||
.SH NAME
|
||||
lpadmin \- configure cups printers and classes
|
||||
.SH SYNOPSIS
|
||||
@@ -30,7 +30,7 @@ lpadmin \- configure cups printers and classes
|
||||
] [ -h
|
||||
.I server[:port]
|
||||
] -p
|
||||
.I printer option(s)
|
||||
.I destination option(s)
|
||||
.br
|
||||
.B lpadmin
|
||||
[ -E ] [-U
|
||||
@@ -55,7 +55,7 @@ destination unless the user specifies otherwise with the
|
||||
\fIlpoptions(1)\fR command.
|
||||
.LP
|
||||
The second form of the command (\fI-p\fR) configures the named
|
||||
printer. The additional options are described below.
|
||||
printer or class. The additional options are described below.
|
||||
.LP
|
||||
The third form of the command (\fI-x\fR) deletes the printer or
|
||||
class \fIdestination\fR. Any jobs that are pending for the
|
||||
@@ -78,8 +78,9 @@ and is intended for providing support for legacy printer drivers.
|
||||
.TP 5
|
||||
-m model
|
||||
.br
|
||||
Sets a standard System V interface script or PPD file from the
|
||||
\fImodel\fR directory.
|
||||
Sets a standard System V interface script or PPD file for the printer from the
|
||||
\fImodel\fR directory or using one of the driver interfaces. Use the \fI-m\fR
|
||||
option with the \fIlpinfo(8)\fR command to get a list of supported models.
|
||||
.TP 5
|
||||
-o job-k-limit=value
|
||||
.br
|
||||
@@ -105,13 +106,12 @@ Sets the default banner page(s) to use for print jobs.
|
||||
.TP 5
|
||||
-o name=value
|
||||
.br
|
||||
Sets a PPD option for the printer. PPD options can be
|
||||
listed using the \fI-l\fR option with the \fIlpoptions(1)\fR
|
||||
command.
|
||||
Sets a PPD option for the printer. PPD options can be listed using the \fI-l\fR
|
||||
option with the \fIlpoptions(1)\fR command.
|
||||
.TP 5
|
||||
-o name-default=value
|
||||
.br
|
||||
Sets a default server-side option for the printer. Any print-time
|
||||
Sets a default server-side option for the destination. Any print-time
|
||||
option can be defaulted, e.g. "-o cpi-default=17" to set the default
|
||||
"cpi" option value to 17.
|
||||
.TP 5
|
||||
@@ -125,20 +125,21 @@ specified port monitor must be listed in the printer's PPD file.
|
||||
.br
|
||||
Sets the error policy to be used when the printer backend is
|
||||
unable to send the job to the printer. The name must be one of
|
||||
"abort-job", "retry-job" or "stop-printer". The default error
|
||||
policy is "stop-printer".
|
||||
"abort-job", "retry-job", "retry-current-job", or "stop-printer". The default
|
||||
error policy is "stop-printer" for printers and "retry-current-job" for
|
||||
classes.
|
||||
.TP 5
|
||||
-o printer-is-shared=true/false
|
||||
.br
|
||||
Sets the printer to shared/published or unshared/unpublished.
|
||||
Shared/published printers are publically announced by the server
|
||||
Sets the destination to shared/published or unshared/unpublished.
|
||||
Shared/published destinations are publically announced by the server
|
||||
on the LAN based on the browsing configuration in
|
||||
\fBcupsd.conf\fR, while unshared/unpublished printers are not
|
||||
\fBcupsd.conf\fR, while unshared/unpublished destinations are not
|
||||
announced. The default value is "true".
|
||||
.TP 5
|
||||
-o printer-op-policy=name
|
||||
.br
|
||||
Sets the IPP operation policy associated with the printer. The
|
||||
Sets the IPP operation policy associated with the destination. The
|
||||
name must be defined in the \fBcupsd.conf\fR in a Policy section.
|
||||
The default operation policy is "default".
|
||||
.TP 5
|
||||
@@ -155,7 +156,7 @@ resulting class becomes empty it is removed.
|
||||
.TP 5
|
||||
-u deny:none
|
||||
.br
|
||||
Sets user-level access control on a printer. Names starting with
|
||||
Sets user-level access control on a destination. Names starting with
|
||||
"@" are interpreted as UNIX groups. The latter two forms turn
|
||||
user-level access control off.
|
||||
.TP 5
|
||||
@@ -163,21 +164,21 @@ user-level access control off.
|
||||
.br
|
||||
Sets the \fIdevice-uri\fR attribute of the printer queue. If
|
||||
\fIdevice-uri\fR is a filename it is automatically converted to
|
||||
the form \fIfile:///file/name\fR. Use the \fIlpinfo(8)\fR command
|
||||
to get a list of supported device URIs and schemes.
|
||||
the form \fIfile:///file/name\fR. Use the \fI-v\fR option with the
|
||||
\fIlpinfo(8)\fR command to get a list of supported device URIs and schemes.
|
||||
.TP 5
|
||||
-D "info"
|
||||
.br
|
||||
Provides a textual description of the printer.
|
||||
Provides a textual description of the destination.
|
||||
.TP 5
|
||||
-E
|
||||
.br
|
||||
Enables the printer and accepts jobs; this is the same as running the
|
||||
\fIcupsaccept(8)\fR and \fIcupsenable(8)\fR programs on the printer.
|
||||
Enables the destination and accepts jobs; this is the same as running the
|
||||
\fIcupsaccept(8)\fR and \fIcupsenable(8)\fR programs on the destination.
|
||||
.TP 5
|
||||
-L "location"
|
||||
.br
|
||||
Provides a textual location of the printer.
|
||||
Provides a textual location of the destination.
|
||||
.TP 5
|
||||
-P ppd-file
|
||||
.br
|
||||
@@ -201,7 +202,7 @@ System V or Solaris printing system configuration options.
|
||||
.br
|
||||
http://localhost:631/help
|
||||
.SH COPYRIGHT
|
||||
Copyright 2007-2009 by Apple Inc.
|
||||
Copyright 2007-2010 by Apple Inc.
|
||||
.\"
|
||||
.\" End of "$Id: lpadmin.man 8421 2009-03-09 21:59:55Z mike $".
|
||||
.\" End of "$Id: lpadmin.man 9291 2010-09-01 15:51:59Z mike $".
|
||||
.\"
|
||||
|
||||
+4
-2
@@ -369,8 +369,10 @@ email_message(const char *to, /* I - Recipient of message */
|
||||
fputs("DEBUG: QUIT\n", stderr);
|
||||
|
||||
if (!cupsFileGets(fp, response, sizeof(response)) || atoi(response) >= 500)
|
||||
goto smtp_error;
|
||||
fprintf(stderr, "DEBUG: <<< %s\n", response);
|
||||
fprintf(stderr, "ERROR: Got \"%s\" trying to QUIT connection.\n",
|
||||
response);
|
||||
else
|
||||
fprintf(stderr, "DEBUG: <<< %s\n", response);
|
||||
|
||||
cupsFileClose(fp);
|
||||
|
||||
|
||||
@@ -707,8 +707,6 @@ f 0444 root sys $MANDIR/man5/mime.convs.$MAN5EXT man/mime.convs.$MAN5EXT
|
||||
f 0444 root sys $MANDIR/man5/mime.types.$MAN5EXT man/mime.types.$MAN5EXT
|
||||
f 0444 root sys $MANDIR/man5/printers.conf.$MAN5EXT man/printers.conf.$MAN5EXT
|
||||
|
||||
f 0444 root sys $MANDIR/man7/drv.$MAN7EXT man/drv.$MAN7EXT
|
||||
|
||||
l 0644 root sys $AMANDIR/man$MAN8DIR/accept.$MAN8EXT cupsaccept.$MAN8EXT
|
||||
f 0444 root sys $AMANDIR/man$MAN8DIR/cupsaccept.$MAN8EXT man/cupsaccept.$MAN8EXT
|
||||
l 0644 root sys $AMANDIR/man$MAN8DIR/cupsreject.$MAN8EXT cupsaccept.$MAN8EXT
|
||||
|
||||
@@ -285,8 +285,6 @@ rm -rf $RPM_BUILD_ROOT
|
||||
%dir /usr/share/man/man5
|
||||
/usr/share/man/man5/*.conf.5.gz
|
||||
/usr/share/man/man5/mime.*.5.gz
|
||||
%dir /usr/share/man/man7
|
||||
/usr/share/man/man7/drv*
|
||||
%dir /usr/share/man/man8
|
||||
/usr/share/man/man8/accept.8.gz
|
||||
/usr/share/man/man8/cupsaddsmb.8.gz
|
||||
|
||||
+2
-2
@@ -3,7 +3,7 @@
|
||||
#
|
||||
# Makefile for the CUPS PPD Compiler.
|
||||
#
|
||||
# Copyright 2007-2010 by Apple Inc.
|
||||
# Copyright 2007-2011 by Apple Inc.
|
||||
# Copyright 2002-2006 by Easy Software Products.
|
||||
#
|
||||
# These coded instructions, statements, and computer programs are the
|
||||
@@ -294,7 +294,7 @@ ppdi-static: ppdc-static ppdi.o libcupsppdc.a ../cups/libcups.a
|
||||
./ppdc-static -I ../data sample.drv
|
||||
./ppdi-static -I ../data -o sample-import.drv ppd/*
|
||||
./ppdc-static -I ../data -d ppd2 sample-import.drv
|
||||
if diff -qr ppd ppd2; then \
|
||||
if diff -r ppd ppd2 >/dev/null; then \
|
||||
echo PPD import OK; \
|
||||
else \
|
||||
echo PPD import FAILED; \
|
||||
|
||||
@@ -1364,17 +1364,17 @@ ppdcSource::get_integer(const char *v) // I - Value string
|
||||
while (isspace(*newv & 255))
|
||||
newv ++;
|
||||
|
||||
if (strncmp(newv, "==", 2))
|
||||
if (!strncmp(newv, "==", 2))
|
||||
{
|
||||
compop = PPDC_EQ;
|
||||
newv += 2;
|
||||
}
|
||||
else if (strncmp(newv, "!=", 2))
|
||||
else if (!strncmp(newv, "!=", 2))
|
||||
{
|
||||
compop = PPDC_NE;
|
||||
newv += 2;
|
||||
}
|
||||
else if (strncmp(newv, "<=", 2))
|
||||
else if (!strncmp(newv, "<=", 2))
|
||||
{
|
||||
compop = PPDC_LE;
|
||||
newv += 2;
|
||||
@@ -1384,7 +1384,7 @@ ppdcSource::get_integer(const char *v) // I - Value string
|
||||
compop = PPDC_LT;
|
||||
newv ++;
|
||||
}
|
||||
else if (strncmp(newv, ">=", 2))
|
||||
else if (!strncmp(newv, ">=", 2))
|
||||
{
|
||||
compop = PPDC_GE;
|
||||
newv += 2;
|
||||
@@ -1405,7 +1405,7 @@ ppdcSource::get_integer(const char *v) // I - Value string
|
||||
if (*newv == ')' || !*newv)
|
||||
return (-1);
|
||||
|
||||
if (isdigit(*v & 255) || *v == '-' || *v == '+')
|
||||
if (isdigit(*newv & 255) || *newv == '-' || *newv == '+')
|
||||
{
|
||||
// Get the second number...
|
||||
temp2 = strtol(newv, &newv, 0);
|
||||
@@ -2046,8 +2046,8 @@ ppdcSource::get_token(ppdcFile *fp, // I - File to read
|
||||
var = find_variable(name);
|
||||
if (var)
|
||||
{
|
||||
strncpy(bufptr, var->value->value, bufend - bufptr);
|
||||
bufptr += strlen(var->value->value);
|
||||
strlcpy(bufptr, var->value->value, bufend - bufptr + 1);
|
||||
bufptr += strlen(bufptr);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2057,7 +2057,7 @@ ppdcSource::get_token(ppdcFile *fp, // I - File to read
|
||||
"%s.\n"), name, fp->line, fp->filename);
|
||||
|
||||
snprintf(bufptr, bufend - bufptr + 1, "$%s", name);
|
||||
bufptr += strlen(name) + 1;
|
||||
bufptr += strlen(bufptr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+5
-5
@@ -1003,7 +1003,7 @@ cupsdAuthorize(cupsd_client_t *con) /* I - Client connection */
|
||||
if (!*authorization)
|
||||
{
|
||||
cupsdLogMessage(CUPSD_LOG_DEBUG2,
|
||||
"cupsdAuthorize: No authentication data specified.");
|
||||
"cupsdAuthorize: No authentication data specified.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1014,7 +1014,7 @@ cupsdAuthorize(cupsd_client_t *con) /* I - Client connection */
|
||||
len = strlen(authorization);
|
||||
input_token.value = malloc(len);
|
||||
input_token.value = httpDecode64_2(input_token.value, &len,
|
||||
authorization);
|
||||
authorization);
|
||||
input_token.length = len;
|
||||
|
||||
/*
|
||||
@@ -1038,7 +1038,7 @@ cupsdAuthorize(cupsd_client_t *con) /* I - Client connection */
|
||||
if (GSS_ERROR(major_status))
|
||||
{
|
||||
cupsdLogGSSMessage(CUPSD_LOG_DEBUG, major_status, minor_status,
|
||||
"cupsdAuthorize: Error accepting GSSAPI security "
|
||||
"cupsdAuthorize: Error accepting GSSAPI security "
|
||||
"context");
|
||||
|
||||
if (context != GSS_C_NO_CONTEXT)
|
||||
@@ -1054,7 +1054,7 @@ cupsdAuthorize(cupsd_client_t *con) /* I - Client connection */
|
||||
|
||||
if (!con->gss_creds)
|
||||
cupsdLogMessage(CUPSD_LOG_DEBUG,
|
||||
"cupsdAuthorize: No delegated credentials!");
|
||||
"cupsdAuthorize: No delegated credentials!");
|
||||
|
||||
if (major_status == GSS_S_CONTINUE_NEEDED)
|
||||
cupsdLogGSSMessage(CUPSD_LOG_DEBUG, major_status, minor_status,
|
||||
@@ -1067,7 +1067,7 @@ cupsdAuthorize(cupsd_client_t *con) /* I - Client connection */
|
||||
if (GSS_ERROR(major_status))
|
||||
{
|
||||
cupsdLogGSSMessage(CUPSD_LOG_DEBUG, major_status, minor_status,
|
||||
"cupsdAuthorize: Error getting username");
|
||||
"cupsdAuthorize: Error getting username");
|
||||
gss_release_cred(&minor_status, &con->gss_creds);
|
||||
gss_release_name(&minor_status, &client_name);
|
||||
gss_delete_sec_context(&minor_status, &context, GSS_C_NO_BUFFER);
|
||||
|
||||
@@ -41,6 +41,7 @@ cupsd_printer_t * /* O - New class */
|
||||
cupsdAddClass(const char *name) /* I - Name of class */
|
||||
{
|
||||
cupsd_printer_t *c; /* New class */
|
||||
char uri[1024]; /* Class URI */
|
||||
|
||||
|
||||
/*
|
||||
@@ -55,8 +56,10 @@ cupsdAddClass(const char *name) /* I - Name of class */
|
||||
|
||||
c->type = CUPS_PRINTER_CLASS;
|
||||
|
||||
cupsdSetStringf(&c->uri, "ipp://%s:%d/classes/%s", ServerName, RemotePort,
|
||||
name);
|
||||
httpAssembleURIf(HTTP_URI_CODING_ALL, uri, sizeof(uri), "ipp", NULL,
|
||||
ServerName, RemotePort, "/classes/%s", name);
|
||||
cupsdSetString(&c->uri, uri);
|
||||
|
||||
cupsdSetString(&c->error_policy, "retry-current-job");
|
||||
}
|
||||
|
||||
@@ -722,7 +725,7 @@ cupsdSaveAllClasses(void)
|
||||
*/
|
||||
|
||||
fchown(cupsFileNumber(fp), RunUser, Group);
|
||||
fchmod(cupsFileNumber(fp), 0600);
|
||||
fchmod(cupsFileNumber(fp), ConfigFilePerm);
|
||||
|
||||
/*
|
||||
* Write a small header to the file...
|
||||
|
||||
+243
-78
@@ -54,19 +54,25 @@
|
||||
|
||||
#ifdef HAVE_CDSASSL
|
||||
# include <Security/Security.h>
|
||||
# include <Security/SecItem.h>
|
||||
# ifdef HAVE_SECITEMPRIV_H
|
||||
# include <Security/SecItemPriv.h>
|
||||
# else /* Declare constant from that header... */
|
||||
extern const CFTypeRef kSecClassIdentity;
|
||||
# endif /* HAVE_SECITEMPRIV_H */
|
||||
# ifdef HAVE_SECIDENTITYSEARCHPRIV_H
|
||||
# include <Security/SecIdentitySearchPriv.h>
|
||||
# else /* Declare prototype for function in that header... */
|
||||
extern OSStatus SecIdentitySearchCreateWithPolicy(SecPolicyRef policy,
|
||||
CFStringRef idString, CSSM_KEYUSE keyUsage,
|
||||
CFTypeRef keychainOrArray,
|
||||
Boolean returnOnlyValidIdentities,
|
||||
extern OSStatus SecIdentitySearchCreateWithPolicy(SecPolicyRef policy,
|
||||
CFStringRef idString, CSSM_KEYUSE keyUsage,
|
||||
CFTypeRef keychainOrArray,
|
||||
Boolean returnOnlyValidIdentities,
|
||||
SecIdentitySearchRef* searchRef);
|
||||
# endif /* HAVE_SECIDENTITYSEARCHPRIV_H */
|
||||
# ifdef HAVE_SECPOLICYPRIV_H
|
||||
# include <Security/SecPolicyPriv.h>
|
||||
# else /* Declare prototype for function in that header... */
|
||||
extern OSStatus SecPolicySetValue(SecPolicyRef policyRef,
|
||||
extern OSStatus SecPolicySetValue(SecPolicyRef policyRef,
|
||||
const CSSM_DATA *value);
|
||||
# endif /* HAVE_SECPOLICYPRIV_H */
|
||||
# ifdef HAVE_SECBASEPRIV_H
|
||||
@@ -1376,6 +1382,35 @@ cupsdReadClient(cupsd_client_t *con) /* I - Client to read from */
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if ((!strncmp(con->uri, "/printers/", 10) ||
|
||||
!strncmp(con->uri, "/classes/", 9)) &&
|
||||
!strcmp(con->uri + strlen(con->uri) - 4, ".png"))
|
||||
{
|
||||
/*
|
||||
* Send icon file - get the real queue name since queue names are
|
||||
* not case sensitive but filenames can be...
|
||||
*/
|
||||
|
||||
con->uri[strlen(con->uri) - 4] = '\0'; /* Drop ".png" */
|
||||
|
||||
if (!strncmp(con->uri, "/printers/", 10))
|
||||
p = cupsdFindPrinter(con->uri + 10);
|
||||
else
|
||||
p = cupsdFindClass(con->uri + 9);
|
||||
|
||||
if (p)
|
||||
snprintf(con->uri, sizeof(con->uri), "/icons/%s.png", p->name);
|
||||
else
|
||||
{
|
||||
if (!cupsdSendError(con, HTTP_NOT_FOUND, CUPSD_AUTH_NONE))
|
||||
{
|
||||
cupsdCloseClient(con);
|
||||
return;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ((!strncmp(con->uri, "/admin", 6) &&
|
||||
strncmp(con->uri, "/admin/conf/", 12) &&
|
||||
@@ -3353,49 +3388,125 @@ get_cdsa_certificate(
|
||||
cupsd_client_t *con) /* I - Client connection */
|
||||
{
|
||||
OSStatus err; /* Error info */
|
||||
SecKeychainRef keychain; /* Keychain reference */
|
||||
SecIdentitySearchRef search; /* Search reference */
|
||||
SecIdentityRef identity; /* Identity */
|
||||
SecKeychainRef keychain = NULL;/* Keychain reference */
|
||||
SecIdentitySearchRef search = NULL; /* Search reference */
|
||||
SecIdentityRef identity = NULL;/* Identity */
|
||||
CFArrayRef certificates = NULL;
|
||||
/* Certificate array */
|
||||
# if HAVE_SECPOLICYCREATESSL
|
||||
SecPolicyRef policy = NULL; /* Policy ref */
|
||||
CFStringRef servername = NULL;
|
||||
/* Server name */
|
||||
CFMutableDictionaryRef query = NULL; /* Query qualifiers */
|
||||
char localname[1024];/* Local hostname */
|
||||
# elif defined(HAVE_SECIDENTITYSEARCHCREATEWITHPOLICY)
|
||||
SecPolicyRef policy = NULL; /* Policy ref */
|
||||
SecPolicySearchRef policy_search = NULL;
|
||||
/* Policy search ref */
|
||||
CSSM_DATA options; /* Policy options */
|
||||
CSSM_APPLE_TP_SSL_OPTIONS
|
||||
ssl_options; /* SSL Option for hostname */
|
||||
char localname[1024];/* Local hostname */
|
||||
# endif /* HAVE_SECPOLICYCREATESSL */
|
||||
|
||||
|
||||
cupsdLogMessage(CUPSD_LOG_DEBUG,
|
||||
"get_cdsa_certificate: Looking for certs for \"%s\"...",
|
||||
con->servername);
|
||||
|
||||
if ((err = SecKeychainOpen(ServerCertificate, &keychain)))
|
||||
{
|
||||
cupsdLogMessage(CUPSD_LOG_ERROR, "Cannot open keychain \"%s\" - %s (%d)",
|
||||
ServerCertificate, cssmErrorString(err), (int)err);
|
||||
return (NULL);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
# if HAVE_SECIDENTITYSEARCHCREATEWITHPOLICY
|
||||
# if HAVE_SECPOLICYCREATESSL
|
||||
servername = CFStringCreateWithCString(kCFAllocatorDefault, con->servername,
|
||||
kCFStringEncodingUTF8);
|
||||
|
||||
if ((policy = SecPolicyCreateSSL(1, servername)) == NULL)
|
||||
{
|
||||
cupsdLogMessage(CUPSD_LOG_ERROR, "Cannot create ssl policy reference");
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (servername)
|
||||
CFRelease(servername);
|
||||
|
||||
if (!(query = CFDictionaryCreateMutable(kCFAllocatorDefault, 0,
|
||||
&kCFTypeDictionaryKeyCallBacks,
|
||||
&kCFTypeDictionaryValueCallBacks)))
|
||||
{
|
||||
cupsdLogMessage(CUPSD_LOG_ERROR, "Cannot create query dictionary");
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
CFDictionaryAddValue(query, kSecClass, kSecClassIdentity);
|
||||
CFDictionaryAddValue(query, kSecMatchPolicy, policy);
|
||||
CFDictionaryAddValue(query, kSecReturnRef, kCFBooleanTrue);
|
||||
CFDictionaryAddValue(query, kSecMatchLimit, kSecMatchLimitOne);
|
||||
|
||||
err = SecItemCopyMatching(query, (CFTypeRef *)&identity);
|
||||
|
||||
if (err && DNSSDHostName)
|
||||
{
|
||||
/*
|
||||
* Search for the connection server name failed; try the DNS-SD .local
|
||||
* hostname instead...
|
||||
*/
|
||||
|
||||
snprintf(localname, sizeof(localname), "%s.local", DNSSDHostName);
|
||||
|
||||
cupsdLogMessage(CUPSD_LOG_DEBUG,
|
||||
"get_cdsa_certificate: Looking for certs for \"%s\"...",
|
||||
localname);
|
||||
|
||||
servername = CFStringCreateWithCString(kCFAllocatorDefault, localname,
|
||||
kCFStringEncodingUTF8);
|
||||
|
||||
CFRelease(policy);
|
||||
|
||||
if ((policy = SecPolicyCreateSSL(1, servername)) == NULL)
|
||||
{
|
||||
cupsdLogMessage(CUPSD_LOG_ERROR, "Cannot create ssl policy reference");
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (servername)
|
||||
CFRelease(servername);
|
||||
|
||||
CFDictionarySetValue(query, kSecMatchPolicy, policy);
|
||||
|
||||
err = SecItemCopyMatching(query, (CFTypeRef *)&identity);
|
||||
}
|
||||
|
||||
if (err)
|
||||
{
|
||||
cupsdLogMessage(CUPSD_LOG_DEBUG,
|
||||
"Cannot find signing key in keychain \"%s\": %s (%d)",
|
||||
ServerCertificate, cssmErrorString(err), (int)err);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
# elif defined(HAVE_SECIDENTITYSEARCHCREATEWITHPOLICY)
|
||||
/*
|
||||
* Use a policy to search for valid certificates who's common name matches the
|
||||
* servername...
|
||||
*/
|
||||
|
||||
SecPolicySearchRef policy_search; /* Policy search ref */
|
||||
SecPolicyRef policy; /* Policy ref */
|
||||
CSSM_DATA options; /* Policy options */
|
||||
CSSM_APPLE_TP_SSL_OPTIONS
|
||||
ssl_options; /* SSL Option for hostname */
|
||||
char localname[1024];/* Local hostname */
|
||||
|
||||
|
||||
if (SecPolicySearchCreate(CSSM_CERT_X_509v3, &CSSMOID_APPLE_TP_SSL,
|
||||
if (SecPolicySearchCreate(CSSM_CERT_X_509v3, &CSSMOID_APPLE_TP_SSL,
|
||||
NULL, &policy_search))
|
||||
{
|
||||
cupsdLogMessage(CUPSD_LOG_ERROR, "Cannot create a policy search reference");
|
||||
CFRelease(keychain);
|
||||
return (NULL);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (SecPolicySearchCopyNext(policy_search, &policy))
|
||||
{
|
||||
cupsdLogMessage(CUPSD_LOG_ERROR,
|
||||
"Cannot find a policy to use for searching");
|
||||
CFRelease(keychain);
|
||||
CFRelease(policy_search);
|
||||
return (NULL);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
memset(&ssl_options, 0, sizeof(ssl_options));
|
||||
@@ -3403,10 +3514,6 @@ get_cdsa_certificate(
|
||||
ssl_options.ServerName = con->servername;
|
||||
ssl_options.ServerNameLen = strlen(con->servername);
|
||||
|
||||
cupsdLogMessage(CUPSD_LOG_DEBUG,
|
||||
"get_cdsa_certificate: Looking for certs for \"%s\"...",
|
||||
con->servername);
|
||||
|
||||
options.Data = (uint8 *)&ssl_options;
|
||||
options.Length = sizeof(ssl_options);
|
||||
|
||||
@@ -3414,13 +3521,20 @@ get_cdsa_certificate(
|
||||
{
|
||||
cupsdLogMessage(CUPSD_LOG_ERROR,
|
||||
"Cannot set policy value to use for searching");
|
||||
CFRelease(keychain);
|
||||
CFRelease(policy_search);
|
||||
return (NULL);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
err = SecIdentitySearchCreateWithPolicy(policy, NULL, CSSM_KEYUSE_SIGN,
|
||||
keychain, FALSE, &search);
|
||||
if ((err = SecIdentitySearchCreateWithPolicy(policy, NULL, CSSM_KEYUSE_SIGN,
|
||||
keychain, FALSE, &search)))
|
||||
{
|
||||
cupsdLogMessage(CUPSD_LOG_ERROR,
|
||||
"Cannot create identity search reference: %s (%d)",
|
||||
cssmErrorString(err), (int)err);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
err = SecIdentitySearchCopyNext(search, &identity);
|
||||
|
||||
if (err && DNSSDHostName)
|
||||
{
|
||||
/*
|
||||
@@ -3441,13 +3555,30 @@ get_cdsa_certificate(
|
||||
{
|
||||
cupsdLogMessage(CUPSD_LOG_ERROR,
|
||||
"Cannot set policy value to use for searching");
|
||||
CFRelease(keychain);
|
||||
CFRelease(policy_search);
|
||||
return (NULL);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
err = SecIdentitySearchCreateWithPolicy(policy, NULL, CSSM_KEYUSE_SIGN,
|
||||
keychain, FALSE, &search);
|
||||
CFRelease(search);
|
||||
search = NULL;
|
||||
if ((err = SecIdentitySearchCreateWithPolicy(policy, NULL, CSSM_KEYUSE_SIGN,
|
||||
keychain, FALSE, &search)))
|
||||
{
|
||||
cupsdLogMessage(CUPSD_LOG_ERROR,
|
||||
"Cannot create identity search reference: %s (%d)",
|
||||
cssmErrorString(err), (int)err);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
err = SecIdentitySearchCopyNext(search, &identity);
|
||||
|
||||
}
|
||||
|
||||
if (err)
|
||||
{
|
||||
cupsdLogMessage(CUPSD_LOG_DEBUG,
|
||||
"Cannot find signing key in keychain \"%s\": %s (%d)",
|
||||
ServerCertificate, cssmErrorString(err), (int)err);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
# else
|
||||
@@ -3455,43 +3586,56 @@ get_cdsa_certificate(
|
||||
* Assume there is exactly one SecIdentity in the keychain...
|
||||
*/
|
||||
|
||||
err = SecIdentitySearchCreate(keychain, CSSM_KEYUSE_SIGN, &search);
|
||||
# endif /* HAVE_SECIDENTITYSEARCHCREATEWITHPOLICY */
|
||||
|
||||
if (err)
|
||||
cupsdLogMessage(CUPSD_LOG_DEBUG,
|
||||
"Cannot create keychain search reference: %s (%d)",
|
||||
cssmErrorString(err), (int)err);
|
||||
else
|
||||
if ((err = SecIdentitySearchCreate(keychain, CSSM_KEYUSE_SIGN, &search)))
|
||||
{
|
||||
if ((err = SecIdentitySearchCopyNext(search, &identity)))
|
||||
{
|
||||
cupsdLogMessage(CUPSD_LOG_DEBUG,
|
||||
"Cannot find signing key in keychain \"%s\": %s (%d)",
|
||||
ServerCertificate, cssmErrorString(err), (int)err);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (CFGetTypeID(identity) != SecIdentityGetTypeID())
|
||||
cupsdLogMessage(CUPSD_LOG_ERROR,
|
||||
"SecIdentitySearchCopyNext CFTypeID failure!");
|
||||
else
|
||||
{
|
||||
if ((certificates = CFArrayCreate(NULL, (const void **)&identity,
|
||||
1, &kCFTypeArrayCallBacks)) == NULL)
|
||||
cupsdLogMessage(CUPSD_LOG_ERROR, "Cannot create certificate array");
|
||||
}
|
||||
|
||||
CFRelease(identity);
|
||||
}
|
||||
|
||||
CFRelease(search);
|
||||
cupsdLogMessage(CUPSD_LOG_DEBUG,
|
||||
"Cannot create identity search reference (%d)", (int)err);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
# if HAVE_SECIDENTITYSEARCHCREATEWITHPOLICY
|
||||
CFRelease(policy);
|
||||
CFRelease(policy_search);
|
||||
# endif /* HAVE_SECIDENTITYSEARCHCREATEWITHPOLICY */
|
||||
if ((err = SecIdentitySearchCopyNext(search, &identity)))
|
||||
{
|
||||
cupsdLogMessage(CUPSD_LOG_DEBUG,
|
||||
"Cannot find signing key in keychain \"%s\": %s (%d)",
|
||||
ServerCertificate, cssmErrorString(err), (int)err);
|
||||
goto cleanup;
|
||||
}
|
||||
# endif /* HAVE_SECPOLICYCREATESSL */
|
||||
|
||||
if (CFGetTypeID(identity) != SecIdentityGetTypeID())
|
||||
{
|
||||
cupsdLogMessage(CUPSD_LOG_ERROR, "SecIdentity CFTypeID failure!");
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if ((certificates = CFArrayCreate(NULL, (const void **)&identity,
|
||||
1, &kCFTypeArrayCallBacks)) == NULL)
|
||||
{
|
||||
cupsdLogMessage(CUPSD_LOG_ERROR, "Cannot create certificate array");
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
cleanup :
|
||||
|
||||
if (keychain)
|
||||
CFRelease(keychain);
|
||||
if (search)
|
||||
CFRelease(search);
|
||||
if (identity)
|
||||
CFRelease(identity);
|
||||
|
||||
# if HAVE_SECPOLICYCREATESSL
|
||||
if (policy)
|
||||
CFRelease(policy);
|
||||
if (query)
|
||||
CFRelease(query);
|
||||
|
||||
# elif defined(HAVE_SECIDENTITYSEARCHCREATEWITHPOLICY)
|
||||
if (policy)
|
||||
CFRelease(policy);
|
||||
if (policy_search)
|
||||
CFRelease(policy_search);
|
||||
# endif /* HAVE_SECPOLICYCREATESSL */
|
||||
|
||||
return (certificates);
|
||||
}
|
||||
@@ -3522,6 +3666,12 @@ get_file(cupsd_client_t *con, /* I - Client connection */
|
||||
|
||||
if (!strncmp(con->uri, "/ppd/", 5))
|
||||
snprintf(filename, len, "%s%s", ServerRoot, con->uri);
|
||||
else if (!strncmp(con->uri, "/icons/", 7) && !strchr(con->uri + 7, '/'))
|
||||
{
|
||||
snprintf(filename, len, "%s/%s", CacheDir, con->uri + 7);
|
||||
if (access(filename, F_OK) < 0)
|
||||
snprintf(filename, len, "%s/images/generic.png", DocumentRoot);
|
||||
}
|
||||
else if (!strncmp(con->uri, "/rss/", 5) && !strchr(con->uri + 5, '/'))
|
||||
snprintf(filename, len, "%s/rss/%s", CacheDir, con->uri + 5);
|
||||
else if (!strncmp(con->uri, "/admin/conf/", 12))
|
||||
@@ -3554,6 +3704,7 @@ get_file(cupsd_client_t *con, /* I - Client connection */
|
||||
*/
|
||||
|
||||
if ((status = stat(filename, filestats)) != 0 && language[0] &&
|
||||
strncmp(con->uri, "/icons/", 7) &&
|
||||
strncmp(con->uri, "/ppd/", 5) &&
|
||||
strncmp(con->uri, "/admin/conf/", 12) &&
|
||||
strncmp(con->uri, "/admin/log/", 11))
|
||||
@@ -4383,11 +4534,20 @@ make_certificate(cupsd_client_t *con) /* I - Client connection */
|
||||
*argv[4], /* Command-line arguments */
|
||||
*envp[MAX_ENV + 1], /* Environment variables */
|
||||
keychain[1024], /* Keychain argument */
|
||||
infofile[1024]; /* Type-in information for cert */
|
||||
infofile[1024], /* Type-in information for cert */
|
||||
localname[1024], /* Local hostname */
|
||||
*servername; /* Name of server in cert */
|
||||
cups_file_t *fp; /* Seed/info file */
|
||||
int infofd; /* Info file descriptor */
|
||||
|
||||
|
||||
if (con->servername && isdigit(con->servername[0] & 255) && DNSSDHostName)
|
||||
{
|
||||
snprintf(localname, sizeof(localname), "%s.local", DNSSDHostName);
|
||||
servername = localname;
|
||||
}
|
||||
else
|
||||
servername = con->servername;
|
||||
|
||||
/*
|
||||
* Run the "certtool" command to generate a self-signed certificate...
|
||||
*/
|
||||
@@ -4415,7 +4575,7 @@ make_certificate(cupsd_client_t *con) /* I - Client connection */
|
||||
}
|
||||
|
||||
cupsFilePrintf(fp, "%s\nr\n\ny\nb\ns\ny\n%s\n\n\n\n\n%s\ny\n",
|
||||
con->servername, con->servername, ServerAdmin);
|
||||
servername, servername, ServerAdmin);
|
||||
cupsFileClose(fp);
|
||||
|
||||
cupsdLogMessage(CUPSD_LOG_INFO,
|
||||
@@ -4504,7 +4664,7 @@ pipe_command(cupsd_client_t *con, /* I - Client connection */
|
||||
char argbuf[10240], /* Argument buffer */
|
||||
*argv[100], /* Argument strings */
|
||||
*envp[MAX_ENV + 20]; /* Environment variables */
|
||||
char auth_type[256], /* CUPSD_AUTH_TYPE environment variable */
|
||||
char auth_type[256], /* AUTH_TYPE environment variable */
|
||||
content_length[1024], /* CONTENT_LENGTH environment variable */
|
||||
content_type[1024], /* CONTENT_TYPE environment variable */
|
||||
http_cookie[32768], /* HTTP_COOKIE environment variable */
|
||||
@@ -4550,7 +4710,12 @@ pipe_command(cupsd_client_t *con, /* I - Client connection */
|
||||
argv[0] = command;
|
||||
|
||||
if (options)
|
||||
strlcpy(argbuf, options, sizeof(argbuf));
|
||||
{
|
||||
commptr = options;
|
||||
if (*commptr == ' ')
|
||||
commptr ++;
|
||||
strlcpy(argbuf, commptr, sizeof(argbuf));
|
||||
}
|
||||
else
|
||||
argbuf[0] = '\0';
|
||||
|
||||
@@ -4649,7 +4814,7 @@ pipe_command(cupsd_client_t *con, /* I - Client connection */
|
||||
|
||||
if (con->username[0])
|
||||
{
|
||||
snprintf(auth_type, sizeof(auth_type), "CUPSD_AUTH_TYPE=%s",
|
||||
snprintf(auth_type, sizeof(auth_type), "AUTH_TYPE=%s",
|
||||
httpGetField(HTTP(con), HTTP_FIELD_AUTHORIZATION));
|
||||
|
||||
if ((uriptr = strchr(auth_type + 10, ' ')) != NULL)
|
||||
|
||||
+35
-2
@@ -1173,6 +1173,19 @@ cupsdReadConfiguration(void)
|
||||
DefaultPolicyPtr = p = cupsdAddPolicy("default");
|
||||
|
||||
cupsdLogMessage(CUPSD_LOG_INFO, "<Policy default>");
|
||||
cupsdLogMessage(CUPSD_LOG_INFO,
|
||||
"<Limit Create-Job Print-Job Print-URI Validate-Job>");
|
||||
cupsdLogMessage(CUPSD_LOG_INFO, "Order Deny,Allow");
|
||||
|
||||
po = cupsdAddPolicyOp(p, NULL, IPP_CREATE_JOB);
|
||||
po->order_type = CUPSD_AUTH_ALLOW;
|
||||
|
||||
cupsdAddPolicyOp(p, po, IPP_PRINT_JOB);
|
||||
cupsdAddPolicyOp(p, po, IPP_PRINT_URI);
|
||||
cupsdAddPolicyOp(p, po, IPP_VALIDATE_JOB);
|
||||
|
||||
cupsdLogMessage(CUPSD_LOG_INFO, "</Limit>");
|
||||
|
||||
cupsdLogMessage(CUPSD_LOG_INFO,
|
||||
"<Limit Send-Document Send-URI Cancel-Job Hold-Job "
|
||||
"Release-Job Restart-Job Purge-Jobs "
|
||||
@@ -3685,10 +3698,30 @@ read_policy(cups_file_t *fp, /* I - Configuration file */
|
||||
linenum);
|
||||
|
||||
/*
|
||||
* Verify that we have an explicit policy for CUPS-Get-Document
|
||||
* (ensures that upgrades do not introduce new security issues...)
|
||||
* Verify that we have an explicit policy for Validate-Job and
|
||||
* CUPS-Get-Document, which ensures that upgrades do not introduce new
|
||||
* security issues...
|
||||
*/
|
||||
|
||||
if ((op = cupsdFindPolicyOp(pol, IPP_VALIDATE_JOB)) == NULL ||
|
||||
op->op == IPP_ANY_OPERATION)
|
||||
{
|
||||
if ((op = cupsdFindPolicyOp(pol, IPP_PRINT_JOB)) != NULL &&
|
||||
op->op != IPP_ANY_OPERATION)
|
||||
{
|
||||
/*
|
||||
* Add a new limit for Validate-Job using the Print-Job limit as a
|
||||
* template...
|
||||
*/
|
||||
|
||||
cupsdLogMessage(CUPSD_LOG_WARN,
|
||||
"No limit for Validate-Job defined in policy %s "
|
||||
"- using Print-Job's policy", pol->name);
|
||||
|
||||
cupsdAddPolicyOp(pol, op, IPP_VALIDATE_JOB);
|
||||
}
|
||||
}
|
||||
|
||||
if ((op = cupsdFindPolicyOp(pol, CUPS_GET_DOCUMENT)) == NULL ||
|
||||
op->op == IPP_ANY_OPERATION)
|
||||
{
|
||||
|
||||
+3
-1
@@ -161,8 +161,10 @@ VAR int MaxFDs VALUE(0);
|
||||
|
||||
VAR time_t ReloadTime VALUE(0);
|
||||
/* Time of reload request... */
|
||||
VAR int NeedReload VALUE(RELOAD_ALL);
|
||||
VAR int NeedReload VALUE(RELOAD_ALL),
|
||||
/* Need to load configuration? */
|
||||
DoingShutdown VALUE(0);
|
||||
/* Shutting down the scheduler? */
|
||||
VAR void *DefaultProfile VALUE(0);
|
||||
/* Default security profile */
|
||||
|
||||
|
||||
+49
-28
@@ -1245,7 +1245,7 @@ add_class(cupsd_client_t *con, /* I - Client connection */
|
||||
|
||||
if (modify)
|
||||
{
|
||||
cupsdAddEvent(CUPSD_EVENT_PRINTER_MODIFIED | CUPSD_EVENT_PRINTER_CONFIG,
|
||||
cupsdAddEvent(CUPSD_EVENT_PRINTER_MODIFIED,
|
||||
pclass, NULL, "Class \"%s\" modified by \"%s\".",
|
||||
pclass->name, get_username(con));
|
||||
|
||||
@@ -1256,7 +1256,7 @@ add_class(cupsd_client_t *con, /* I - Client connection */
|
||||
{
|
||||
cupsdAddPrinterHistory(pclass);
|
||||
|
||||
cupsdAddEvent(CUPSD_EVENT_PRINTER_ADDED | CUPSD_EVENT_PRINTER_CONFIG,
|
||||
cupsdAddEvent(CUPSD_EVENT_PRINTER_ADDED,
|
||||
pclass, NULL, "New class \"%s\" added by \"%s\".",
|
||||
pclass->name, get_username(con));
|
||||
|
||||
@@ -1350,7 +1350,6 @@ add_job(cupsd_client_t *con, /* I - Client connection */
|
||||
int kbytes; /* Size of print file */
|
||||
int i; /* Looping var */
|
||||
int lowerpagerange; /* Page range bound */
|
||||
const char *ppd; /* PPD keyword for media selection */
|
||||
int exact; /* Did we have an exact match? */
|
||||
ipp_attribute_t *media_col, /* media-col attribute */
|
||||
*media_margin; /* media-*-margin attribute */
|
||||
@@ -1524,22 +1523,10 @@ add_job(cupsd_client_t *con, /* I - Client connection */
|
||||
* Do media selection as needed...
|
||||
*/
|
||||
|
||||
if (!ippFindAttribute(con->request, "InputSlot", IPP_TAG_ZERO) &&
|
||||
(ppd = _pwgGetInputSlot(printer->pwg, con->request, NULL)) != NULL)
|
||||
ippAddString(con->request, IPP_TAG_JOB, IPP_TAG_NAME, "InputSlot", NULL,
|
||||
ppd);
|
||||
|
||||
if (!ippFindAttribute(con->request, "MediaType", IPP_TAG_ZERO) &&
|
||||
(ppd = _pwgGetMediaType(printer->pwg, con->request, NULL)) != NULL)
|
||||
ippAddString(con->request, IPP_TAG_JOB, IPP_TAG_NAME, "MediaType", NULL,
|
||||
ppd);
|
||||
|
||||
if (!ippFindAttribute(con->request, "PageSize", IPP_TAG_ZERO) &&
|
||||
(ppd = _pwgGetPageSize(printer->pwg, con->request, NULL, &exact)) != NULL)
|
||||
if (!ippFindAttribute(con->request, "PageRegion", IPP_TAG_ZERO) &&
|
||||
!ippFindAttribute(con->request, "PageSize", IPP_TAG_ZERO) &&
|
||||
_pwgGetPageSize(printer->pwg, con->request, NULL, &exact))
|
||||
{
|
||||
ippAddString(con->request, IPP_TAG_JOB, IPP_TAG_NAME, "PageSize", NULL,
|
||||
ppd);
|
||||
|
||||
if (!exact &&
|
||||
(media_col = ippFindAttribute(con->request, "media-col",
|
||||
IPP_TAG_BEGIN_COLLECTION)) != NULL)
|
||||
@@ -2936,19 +2923,21 @@ add_printer(cupsd_client_t *con, /* I - Client connection */
|
||||
{
|
||||
/*
|
||||
* If we changed the PPD/interface script, then remove the printer's cache
|
||||
* file...
|
||||
* file and clear the printer-state-reasons...
|
||||
*/
|
||||
|
||||
char cache_name[1024]; /* Cache filename for printer attrs */
|
||||
|
||||
snprintf(cache_name, sizeof(cache_name), "%s/%s.ipp", CacheDir,
|
||||
snprintf(cache_name, sizeof(cache_name), "%s/%s.ipp4", CacheDir,
|
||||
printer->name);
|
||||
unlink(cache_name);
|
||||
|
||||
snprintf(cache_name, sizeof(cache_name), "%s/%s.pwg", CacheDir,
|
||||
snprintf(cache_name, sizeof(cache_name), "%s/%s.pwg3", CacheDir,
|
||||
printer->name);
|
||||
unlink(cache_name);
|
||||
|
||||
cupsdSetPrinterReasons(printer, "none");
|
||||
|
||||
#ifdef __APPLE__
|
||||
/*
|
||||
* (Re)register color profiles...
|
||||
@@ -3025,7 +3014,7 @@ add_printer(cupsd_client_t *con, /* I - Client connection */
|
||||
|
||||
if (modify)
|
||||
{
|
||||
cupsdAddEvent(CUPSD_EVENT_PRINTER_MODIFIED | CUPSD_EVENT_PRINTER_CONFIG,
|
||||
cupsdAddEvent(CUPSD_EVENT_PRINTER_MODIFIED,
|
||||
printer, NULL, "Printer \"%s\" modified by \"%s\".",
|
||||
printer->name, get_username(con));
|
||||
|
||||
@@ -3036,7 +3025,7 @@ add_printer(cupsd_client_t *con, /* I - Client connection */
|
||||
{
|
||||
cupsdAddPrinterHistory(printer);
|
||||
|
||||
cupsdAddEvent(CUPSD_EVENT_PRINTER_ADDED | CUPSD_EVENT_PRINTER_CONFIG,
|
||||
cupsdAddEvent(CUPSD_EVENT_PRINTER_ADDED,
|
||||
printer, NULL, "New printer \"%s\" added by \"%s\".",
|
||||
printer->name, get_username(con));
|
||||
|
||||
@@ -4295,7 +4284,8 @@ check_rss_recipient(
|
||||
* 'check_quotas()' - Check quotas for a printer and user.
|
||||
*/
|
||||
|
||||
static int /* O - 1 if OK, 0 if not */
|
||||
static int /* O - 1 if OK, 0 if forbidden,
|
||||
-1 if limit reached */
|
||||
check_quotas(cupsd_client_t *con, /* I - Client connection */
|
||||
cupsd_printer_t *p) /* I - Printer or class */
|
||||
{
|
||||
@@ -4345,7 +4335,7 @@ check_quotas(cupsd_client_t *con, /* I - Client connection */
|
||||
{
|
||||
cupsdLogMessage(CUPSD_LOG_INFO, "Too many jobs for printer \"%s\"...",
|
||||
p->name);
|
||||
return (0);
|
||||
return (-1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4359,7 +4349,7 @@ check_quotas(cupsd_client_t *con, /* I - Client connection */
|
||||
{
|
||||
cupsdLogMessage(CUPSD_LOG_INFO, "Too many jobs for user \"%s\"...",
|
||||
username);
|
||||
return (0);
|
||||
return (-1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5507,6 +5497,8 @@ copy_printer_attrs(
|
||||
{
|
||||
char printer_uri[HTTP_MAX_URI];
|
||||
/* Printer URI */
|
||||
char printer_icons[HTTP_MAX_URI];
|
||||
/* Printer icons */
|
||||
time_t curtime; /* Current time */
|
||||
int i; /* Looping var */
|
||||
ipp_attribute_t *history; /* History collection */
|
||||
@@ -5614,6 +5606,16 @@ copy_printer_attrs(
|
||||
sizeof(errors) / sizeof(errors[0]), NULL, errors);
|
||||
}
|
||||
|
||||
if (!ra || cupsArrayFind(ra, "printer-icons"))
|
||||
{
|
||||
httpAssembleURIf(HTTP_URI_CODING_ALL, printer_icons, sizeof(printer_icons),
|
||||
"http", NULL, con->servername, con->serverport,
|
||||
"/icons/%s.png", printer->name);
|
||||
ippAddString(con->response, IPP_TAG_PRINTER, IPP_TAG_URI, "printer-icons",
|
||||
NULL, printer_icons);
|
||||
cupsdLogMessage(CUPSD_LOG_DEBUG2, "printer-icons=\"%s\"", printer_icons);
|
||||
}
|
||||
|
||||
if (!ra || cupsArrayFind(ra, "printer-is-accepting-jobs"))
|
||||
ippAddBoolean(con->response, IPP_TAG_PRINTER, "printer-is-accepting-jobs",
|
||||
printer->accepting);
|
||||
@@ -6507,10 +6509,13 @@ delete_printer(cupsd_client_t *con, /* I - Client connection */
|
||||
printer->name);
|
||||
unlink(filename);
|
||||
|
||||
snprintf(filename, sizeof(filename), "%s/%s.ipp", CacheDir, printer->name);
|
||||
snprintf(filename, sizeof(filename), "%s/%s.ipp4", CacheDir, printer->name);
|
||||
unlink(filename);
|
||||
|
||||
snprintf(filename, sizeof(filename), "%s/%s.pwg", CacheDir, printer->name);
|
||||
snprintf(filename, sizeof(filename), "%s/%s.png", CacheDir, printer->name);
|
||||
unlink(filename);
|
||||
|
||||
snprintf(filename, sizeof(filename), "%s/%s.pwg3", CacheDir, printer->name);
|
||||
unlink(filename);
|
||||
|
||||
#ifdef __APPLE__
|
||||
@@ -11411,6 +11416,7 @@ static void
|
||||
validate_job(cupsd_client_t *con, /* I - Client connection */
|
||||
ipp_attribute_t *uri) /* I - Printer URI */
|
||||
{
|
||||
int i; /* Temporary variable */
|
||||
http_status_t status; /* Policy status */
|
||||
ipp_attribute_t *attr; /* Current attribute */
|
||||
ipp_attribute_t *format; /* Document-format attribute */
|
||||
@@ -11496,6 +11502,21 @@ validate_job(cupsd_client_t *con, /* I - Client connection */
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Check quotas...
|
||||
*/
|
||||
|
||||
if ((i = check_quotas(con, printer)) < 0)
|
||||
{
|
||||
send_ipp_status(con, IPP_NOT_POSSIBLE, _("Quota limit reached."));
|
||||
return;
|
||||
}
|
||||
else if (i == 0)
|
||||
{
|
||||
send_ipp_status(con, IPP_NOT_AUTHORIZED, _("Not allowed to print."));
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Everything was ok, so return OK status...
|
||||
*/
|
||||
|
||||
+198
-28
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
* "$Id$"
|
||||
*
|
||||
* Job management routines for the Common UNIX Printing System (CUPS).
|
||||
* Job management routines for the CUPS scheduler.
|
||||
*
|
||||
* Copyright 2007-2009 by Apple Inc.
|
||||
* Copyright 2007-2010 by Apple Inc.
|
||||
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
@@ -173,7 +173,7 @@ static void free_job_history(cupsd_job_t *job);
|
||||
static char *get_options(cupsd_job_t *job, int banner_page, char *copies,
|
||||
size_t copies_size, char *title,
|
||||
size_t title_size);
|
||||
static int ipp_length(ipp_t *ipp);
|
||||
static size_t ipp_length(ipp_t *ipp);
|
||||
static void load_job_cache(const char *filename);
|
||||
static void load_next_job_id(const char *filename);
|
||||
static void load_request_root(void);
|
||||
@@ -294,6 +294,9 @@ cupsdCheckJobs(void)
|
||||
|
||||
if (job->kill_time && job->kill_time <= curtime)
|
||||
{
|
||||
cupsdLogMessage(CUPSD_LOG_ERROR, "[Job %d] Stopping unresponsive job!",
|
||||
job->id);
|
||||
|
||||
stop_job(job, CUPSD_JOB_FORCE);
|
||||
continue;
|
||||
}
|
||||
@@ -348,7 +351,7 @@ cupsdCheckJobs(void)
|
||||
*/
|
||||
|
||||
if (job->state_value == IPP_JOB_PENDING && !NeedReload && !Sleeping &&
|
||||
!job->printer)
|
||||
!DoingShutdown && !job->printer)
|
||||
{
|
||||
printer = cupsdFindDest(job->dest);
|
||||
pclass = NULL;
|
||||
@@ -2722,6 +2725,12 @@ finalize_job(cupsd_job_t *job, /* I - Job */
|
||||
cupsdDestroyProfile(job->profile);
|
||||
job->profile = NULL;
|
||||
|
||||
/*
|
||||
* Clear the unresponsive job watchdog timer...
|
||||
*/
|
||||
|
||||
job->kill_time = 0;
|
||||
|
||||
/*
|
||||
* Close pipes and status buffer...
|
||||
*/
|
||||
@@ -2857,7 +2866,7 @@ finalize_job(cupsd_job_t *job, /* I - Job */
|
||||
|
||||
job->tries ++;
|
||||
|
||||
if (job->tries >= JobRetryLimit)
|
||||
if (job->tries > JobRetryLimit && JobRetryLimit > 0)
|
||||
{
|
||||
/*
|
||||
* Too many tries...
|
||||
@@ -3021,39 +3030,183 @@ get_options(cupsd_job_t *job, /* I - Job */
|
||||
size_t title_size) /* I - Size of title buffer */
|
||||
{
|
||||
int i; /* Looping var */
|
||||
size_t newlength; /* New option buffer length */
|
||||
char *optptr, /* Pointer to options */
|
||||
*valptr; /* Pointer in value string */
|
||||
ipp_attribute_t *attr; /* Current attribute */
|
||||
_pwg_t *pwg; /* PWG->PPD mapping data */
|
||||
int num_pwgppds; /* Number of PWG->PPD options */
|
||||
cups_option_t *pwgppds, /* PWG->PPD options */
|
||||
*pwgppd, /* Current PWG->PPD option */
|
||||
*preset; /* Current preset option */
|
||||
int output_mode, /* Output mode (if any) */
|
||||
print_quality; /* Print quality (if any) */
|
||||
const char *ppd; /* PPD option choice */
|
||||
int exact; /* Did we get an exact match? */
|
||||
static char *options = NULL;/* Full list of options */
|
||||
static int optlength = 0; /* Length of option buffer */
|
||||
static size_t optlength = 0; /* Length of option buffer */
|
||||
|
||||
|
||||
/*
|
||||
* Building the options string is harder than it needs to be, but
|
||||
* for the moment we need to pass strings for command-line args and
|
||||
* not IPP attribute pointers... :)
|
||||
* Building the options string is harder than it needs to be, but for the
|
||||
* moment we need to pass strings for command-line args and not IPP attribute
|
||||
* pointers... :)
|
||||
*
|
||||
* First allocate/reallocate the option buffer as needed...
|
||||
* First build an options array for any PWG->PPD mapped option/choice pairs.
|
||||
*/
|
||||
|
||||
i = ipp_length(job->attrs);
|
||||
pwg = job->printer->pwg;
|
||||
num_pwgppds = 0;
|
||||
pwgppds = NULL;
|
||||
|
||||
if (i > optlength || !options)
|
||||
if (pwg &&
|
||||
!ippFindAttribute(job->attrs,
|
||||
"com.apple.print.DocumentTicket.PMSpoolFormat",
|
||||
IPP_TAG_ZERO) &&
|
||||
(ippFindAttribute(job->attrs, "output-mode", IPP_TAG_ZERO) ||
|
||||
ippFindAttribute(job->attrs, "print-quality", IPP_TAG_ZERO)))
|
||||
{
|
||||
/*
|
||||
* Map output-mode and print-quality to a preset...
|
||||
*/
|
||||
|
||||
if ((attr = ippFindAttribute(job->attrs, "output-mode",
|
||||
IPP_TAG_KEYWORD)) != NULL &&
|
||||
!strcmp(attr->values[0].string.text, "monochrome"))
|
||||
output_mode = _PWG_OUTPUT_MODE_MONOCHROME;
|
||||
else
|
||||
output_mode = _PWG_OUTPUT_MODE_COLOR;
|
||||
|
||||
if ((attr = ippFindAttribute(job->attrs, "print-quality",
|
||||
IPP_TAG_ENUM)) != NULL &&
|
||||
attr->values[0].integer >= IPP_QUALITY_DRAFT &&
|
||||
attr->values[0].integer <= IPP_QUALITY_HIGH)
|
||||
print_quality = attr->values[0].integer - IPP_QUALITY_DRAFT;
|
||||
else
|
||||
print_quality = _PWG_PRINT_QUALITY_NORMAL;
|
||||
|
||||
if (pwg->num_presets[output_mode][print_quality] == 0)
|
||||
{
|
||||
/*
|
||||
* Try to find a preset that works so that we maximize the chances of us
|
||||
* getting a good print using IPP attributes.
|
||||
*/
|
||||
|
||||
if (pwg->num_presets[output_mode][_PWG_PRINT_QUALITY_NORMAL] > 0)
|
||||
print_quality = _PWG_PRINT_QUALITY_NORMAL;
|
||||
else if (pwg->num_presets[_PWG_OUTPUT_MODE_COLOR][print_quality] > 0)
|
||||
output_mode = _PWG_OUTPUT_MODE_COLOR;
|
||||
else
|
||||
{
|
||||
print_quality = _PWG_PRINT_QUALITY_NORMAL;
|
||||
output_mode = _PWG_OUTPUT_MODE_COLOR;
|
||||
}
|
||||
}
|
||||
|
||||
if (pwg->num_presets[output_mode][print_quality] > 0)
|
||||
{
|
||||
/*
|
||||
* Copy the preset options as long as the corresponding names are not
|
||||
* already defined in the IPP request...
|
||||
*/
|
||||
|
||||
for (i = pwg->num_presets[output_mode][print_quality],
|
||||
preset = pwg->presets[output_mode][print_quality];
|
||||
i > 0;
|
||||
i --, preset ++)
|
||||
{
|
||||
if (!ippFindAttribute(job->attrs, preset->name, IPP_TAG_ZERO))
|
||||
num_pwgppds = cupsAddOption(preset->name, preset->value, num_pwgppds,
|
||||
&pwgppds);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (pwg)
|
||||
{
|
||||
if (pwg->sides_option &&
|
||||
!ippFindAttribute(job->attrs, pwg->sides_option, IPP_TAG_ZERO) &&
|
||||
(attr = ippFindAttribute(job->attrs, "sides", IPP_TAG_KEYWORD)) != NULL)
|
||||
{
|
||||
/*
|
||||
* Add a duplex option...
|
||||
*/
|
||||
|
||||
if (!strcmp(attr->values[0].string.text, "one-sided"))
|
||||
num_pwgppds = cupsAddOption(pwg->sides_option, pwg->sides_1sided,
|
||||
num_pwgppds, &pwgppds);
|
||||
else if (!strcmp(attr->values[0].string.text, "two-sided-long-edge"))
|
||||
num_pwgppds = cupsAddOption(pwg->sides_option, pwg->sides_2sided_long,
|
||||
num_pwgppds, &pwgppds);
|
||||
else if (!strcmp(attr->values[0].string.text, "two-sided-short-edge"))
|
||||
num_pwgppds = cupsAddOption(pwg->sides_option, pwg->sides_2sided_short,
|
||||
num_pwgppds, &pwgppds);
|
||||
}
|
||||
|
||||
if (!ippFindAttribute(job->attrs, "InputSlot", IPP_TAG_ZERO) &&
|
||||
!ippFindAttribute(job->attrs, "HPPaperSource", IPP_TAG_ZERO))
|
||||
{
|
||||
if ((ppd = _pwgGetInputSlot(pwg, job->attrs, NULL)) != NULL)
|
||||
num_pwgppds = cupsAddOption(pwg->source_option, ppd, num_pwgppds,
|
||||
&pwgppds);
|
||||
else if (!ippFindAttribute(job->attrs, "AP_D_InputSlot", IPP_TAG_ZERO))
|
||||
num_pwgppds = cupsAddOption("AP_D_InputSlot", "", num_pwgppds,
|
||||
&pwgppds);
|
||||
}
|
||||
|
||||
if (!ippFindAttribute(job->attrs, "MediaType", IPP_TAG_ZERO) &&
|
||||
(ppd = _pwgGetMediaType(pwg, job->attrs, NULL)) != NULL)
|
||||
num_pwgppds = cupsAddOption("MediaType", ppd, num_pwgppds, &pwgppds);
|
||||
|
||||
if (!ippFindAttribute(job->attrs, "PageRegion", IPP_TAG_ZERO) &&
|
||||
!ippFindAttribute(job->attrs, "PageSize", IPP_TAG_ZERO) &&
|
||||
(ppd = _pwgGetPageSize(pwg, job->attrs, NULL, &exact)) != NULL)
|
||||
{
|
||||
num_pwgppds = cupsAddOption("PageSize", ppd, num_pwgppds, &pwgppds);
|
||||
|
||||
if (!ippFindAttribute(job->attrs, "media", IPP_TAG_ZERO))
|
||||
num_pwgppds = cupsAddOption("media", ppd, num_pwgppds, &pwgppds);
|
||||
}
|
||||
|
||||
if (!ippFindAttribute(job->attrs, "OutputBin", IPP_TAG_ZERO) &&
|
||||
(attr = ippFindAttribute(job->attrs, "output-bin",
|
||||
IPP_TAG_ZERO)) != NULL &&
|
||||
(attr->value_tag == IPP_TAG_KEYWORD ||
|
||||
attr->value_tag == IPP_TAG_NAME) &&
|
||||
(ppd = _pwgGetOutputBin(pwg, attr->values[0].string.text)) != NULL)
|
||||
num_pwgppds = cupsAddOption("OutputBin", ppd, num_pwgppds, &pwgppds);
|
||||
}
|
||||
|
||||
/*
|
||||
* Figure out how much room we need...
|
||||
*/
|
||||
|
||||
newlength = ipp_length(job->attrs);
|
||||
|
||||
for (i = num_pwgppds, pwgppd = pwgppds; i > 0; i --, pwgppd ++)
|
||||
newlength += 1 + strlen(pwgppd->name) + 1 + strlen(pwgppd->value);
|
||||
|
||||
/*
|
||||
* Then allocate/reallocate the option buffer as needed...
|
||||
*/
|
||||
|
||||
if (newlength > optlength || !options)
|
||||
{
|
||||
if (!options)
|
||||
optptr = malloc(i);
|
||||
optptr = malloc(newlength);
|
||||
else
|
||||
optptr = realloc(options, i);
|
||||
optptr = realloc(options, newlength);
|
||||
|
||||
if (!optptr)
|
||||
{
|
||||
cupsdLogJob(job, CUPSD_LOG_CRIT,
|
||||
"Unable to allocate %d bytes for option buffer!", i);
|
||||
"Unable to allocate " CUPS_LLFMT " bytes for option buffer!",
|
||||
CUPS_LLCAST newlength);
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
options = optptr;
|
||||
optlength = i;
|
||||
optlength = newlength;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -3089,7 +3242,8 @@ get_options(cupsd_job_t *job, /* I - Job */
|
||||
* Filter out other unwanted attributes...
|
||||
*/
|
||||
|
||||
if (attr->value_tag == IPP_TAG_MIMETYPE ||
|
||||
if (attr->value_tag == IPP_TAG_NOVALUE ||
|
||||
attr->value_tag == IPP_TAG_MIMETYPE ||
|
||||
attr->value_tag == IPP_TAG_NAMELANG ||
|
||||
attr->value_tag == IPP_TAG_TEXTLANG ||
|
||||
(attr->value_tag == IPP_TAG_URI && strcmp(attr->name, "job-uuid")) ||
|
||||
@@ -3097,8 +3251,7 @@ get_options(cupsd_job_t *job, /* I - Job */
|
||||
attr->value_tag == IPP_TAG_BEGIN_COLLECTION) /* Not yet supported */
|
||||
continue;
|
||||
|
||||
if (!strncmp(attr->name, "time-", 5) ||
|
||||
!strcmp(attr->name, "job-hold-until"))
|
||||
if (!strcmp(attr->name, "job-hold-until"))
|
||||
continue;
|
||||
|
||||
if (!strncmp(attr->name, "job-", 4) &&
|
||||
@@ -3156,7 +3309,6 @@ get_options(cupsd_job_t *job, /* I - Job */
|
||||
if (!attr->values[i].boolean)
|
||||
strlcat(optptr, "no", optlength - (optptr - options));
|
||||
|
||||
case IPP_TAG_NOVALUE :
|
||||
strlcat(optptr, attr->name,
|
||||
optlength - (optptr - options));
|
||||
break;
|
||||
@@ -3205,6 +3357,25 @@ get_options(cupsd_job_t *job, /* I - Job */
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Finally loop through the PWG->PPD mapped options and add them...
|
||||
*/
|
||||
|
||||
for (i = num_pwgppds, pwgppd = pwgppds; i > 0; i --, pwgppd ++)
|
||||
{
|
||||
*optptr++ = ' ';
|
||||
strcpy(optptr, pwgppd->name);
|
||||
optptr += strlen(optptr);
|
||||
*optptr++ = '=';
|
||||
strcpy(optptr, pwgppd->value);
|
||||
optptr += strlen(optptr);
|
||||
}
|
||||
|
||||
cupsFreeOptions(num_pwgppds, pwgppds);
|
||||
|
||||
/*
|
||||
* Return the options string...
|
||||
*/
|
||||
|
||||
return (options);
|
||||
}
|
||||
@@ -3215,10 +3386,10 @@ get_options(cupsd_job_t *job, /* I - Job */
|
||||
* the textual IPP attributes.
|
||||
*/
|
||||
|
||||
static int /* O - Size of attribute buffer */
|
||||
static size_t /* O - Size of attribute buffer */
|
||||
ipp_length(ipp_t *ipp) /* I - IPP request */
|
||||
{
|
||||
int bytes; /* Number of bytes */
|
||||
size_t bytes; /* Number of bytes */
|
||||
int i; /* Looping var */
|
||||
ipp_attribute_t *attr; /* Current attribute */
|
||||
|
||||
@@ -3235,16 +3406,14 @@ ipp_length(ipp_t *ipp) /* I - IPP request */
|
||||
* Skip attributes that won't be sent to filters...
|
||||
*/
|
||||
|
||||
if (attr->value_tag == IPP_TAG_MIMETYPE ||
|
||||
if (attr->value_tag == IPP_TAG_NOVALUE ||
|
||||
attr->value_tag == IPP_TAG_MIMETYPE ||
|
||||
attr->value_tag == IPP_TAG_NAMELANG ||
|
||||
attr->value_tag == IPP_TAG_TEXTLANG ||
|
||||
attr->value_tag == IPP_TAG_URI ||
|
||||
attr->value_tag == IPP_TAG_URISCHEME)
|
||||
continue;
|
||||
|
||||
if (strncmp(attr->name, "time-", 5) == 0)
|
||||
continue;
|
||||
|
||||
/*
|
||||
* Add space for a leading space and commas between each value.
|
||||
* For the first attribute, the leading space isn't used, so the
|
||||
@@ -4286,7 +4455,8 @@ update_job(cupsd_job_t *job) /* I - Job to check */
|
||||
{
|
||||
cupsdLogJob(job, loglevel, "%s", message);
|
||||
|
||||
if (loglevel < CUPSD_LOG_DEBUG)
|
||||
if (loglevel < CUPSD_LOG_DEBUG &&
|
||||
strcmp(job->printer->state_message, ptr))
|
||||
{
|
||||
strlcpy(job->printer->state_message, message,
|
||||
sizeof(job->printer->state_message));
|
||||
@@ -4321,7 +4491,7 @@ update_job(cupsd_job_t *job) /* I - Job to check */
|
||||
if (event & CUPSD_EVENT_JOB_PROGRESS)
|
||||
cupsdAddEvent(CUPSD_EVENT_JOB_PROGRESS, job->printer, job,
|
||||
"%s", job->printer->state_message);
|
||||
else if (event & CUPSD_EVENT_PRINTER_STATE)
|
||||
if (event & CUPSD_EVENT_PRINTER_STATE)
|
||||
cupsdAddEvent(CUPSD_EVENT_PRINTER_STATE, job->printer, NULL,
|
||||
(job->printer->type & CUPS_PRINTER_CLASS) ?
|
||||
"Class \"%s\" state changed." :
|
||||
|
||||
+11
-6
@@ -728,6 +728,8 @@ main(int argc, /* I - Number of command-line args */
|
||||
* Shutdown the server...
|
||||
*/
|
||||
|
||||
DoingShutdown = 1;
|
||||
|
||||
cupsdStopServer();
|
||||
|
||||
/*
|
||||
@@ -758,6 +760,8 @@ main(int argc, /* I - Number of command-line args */
|
||||
* Startup the server...
|
||||
*/
|
||||
|
||||
DoingShutdown = 0;
|
||||
|
||||
cupsdStartServer();
|
||||
|
||||
/*
|
||||
@@ -792,8 +796,7 @@ main(int argc, /* I - Number of command-line args */
|
||||
!cupsArrayCount(ActiveJobs) &&
|
||||
(!Browsing ||
|
||||
(!BrowseRemoteProtocols &&
|
||||
(!NumBrowsers || !BrowseLocalProtocols ||
|
||||
cupsArrayCount(Printers) == 0))))
|
||||
(!BrowseLocalProtocols || !cupsArrayCount(Printers)))))
|
||||
{
|
||||
timeout = LaunchdTimeout;
|
||||
launchd_idle_exit = 1;
|
||||
@@ -1134,6 +1137,8 @@ main(int argc, /* I - Number of command-line args */
|
||||
* Close all network clients...
|
||||
*/
|
||||
|
||||
DoingShutdown = 1;
|
||||
|
||||
cupsdStopServer();
|
||||
|
||||
#ifdef HAVE_LAUNCHD
|
||||
@@ -1656,10 +1661,10 @@ launchd_checkout(void)
|
||||
* shared printers to advertise...
|
||||
*/
|
||||
|
||||
if ((cupsArrayCount(ActiveJobs) || NumPolled ||
|
||||
(Browsing &&
|
||||
(BrowseRemoteProtocols ||
|
||||
(BrowseLocalProtocols && NumBrowsers && cupsArrayCount(Printers))))))
|
||||
if (cupsArrayCount(ActiveJobs) || NumPolled ||
|
||||
(Browsing &&
|
||||
(BrowseRemoteProtocols ||
|
||||
(BrowseLocalProtocols && cupsArrayCount(Printers)))))
|
||||
{
|
||||
cupsdLogMessage(CUPSD_LOG_DEBUG,
|
||||
"Creating launchd keepalive file \"" CUPS_KEEPALIVE
|
||||
|
||||
+229
-16
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* "$Id$"
|
||||
*
|
||||
* Printer routines for the Common UNIX Printing System (CUPS).
|
||||
* Printer routines for the CUPS scheduler.
|
||||
*
|
||||
* Copyright 2007-2010 by Apple Inc.
|
||||
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
|
||||
@@ -65,6 +65,21 @@
|
||||
|
||||
#include "cupsd.h"
|
||||
#include <cups/dir.h>
|
||||
#ifdef HAVE_APPLICATIONSERVICES_H
|
||||
# include <ApplicationServices/ApplicationServices.h>
|
||||
#endif /* HAVE_APPLICATIONSERVICES_H */
|
||||
#ifdef HAVE_SYS_MOUNT_H
|
||||
# include <sys/mount.h>
|
||||
#endif /* HAVE_SYS_MOUNT_H */
|
||||
#ifdef HAVE_SYS_STATFS_H
|
||||
# include <sys/statfs.h>
|
||||
#endif /* HAVE_SYS_STATFS_H */
|
||||
#ifdef HAVE_SYS_STATVFS_H
|
||||
# include <sys/statvfs.h>
|
||||
#endif /* HAVE_SYS_STATVFS_H */
|
||||
#ifdef HAVE_SYS_VFS_H
|
||||
# include <sys/vfs.h>
|
||||
#endif /* HAVE_SYS_VFS_H */
|
||||
|
||||
|
||||
/*
|
||||
@@ -97,6 +112,7 @@ cupsd_printer_t * /* O - New printer */
|
||||
cupsdAddPrinter(const char *name) /* I - Name of printer */
|
||||
{
|
||||
cupsd_printer_t *p; /* New printer */
|
||||
char uri[1024]; /* Printer URI */
|
||||
|
||||
|
||||
/*
|
||||
@@ -120,8 +136,9 @@ cupsdAddPrinter(const char *name) /* I - Name of printer */
|
||||
cupsdSetString(&p->info, name);
|
||||
cupsdSetString(&p->hostname, ServerName);
|
||||
|
||||
cupsdSetStringf(&p->uri, "ipp://%s:%d/printers/%s", ServerName, RemotePort,
|
||||
name);
|
||||
httpAssembleURIf(HTTP_URI_CODING_ALL, uri, sizeof(uri), "ipp", NULL,
|
||||
ServerName, RemotePort, "/printers/%s", name);
|
||||
cupsdSetString(&p->uri, uri);
|
||||
cupsdSetDeviceURI(p, "file:///dev/null");
|
||||
|
||||
p->state = IPP_PRINTER_STOPPED;
|
||||
@@ -275,6 +292,14 @@ cupsdCreateCommonData(void)
|
||||
char filename[1024], /* Filename */
|
||||
*notifier; /* Current notifier */
|
||||
cupsd_policy_t *p; /* Current policy */
|
||||
int k_supported; /* Maximum file size supported */
|
||||
#ifdef HAVE_STATFS
|
||||
struct statfs spoolinfo; /* FS info for spool directory */
|
||||
double spoolsize; /* FS size */
|
||||
#elif defined(HAVE_STATVFS)
|
||||
struct statvfs spoolinfo; /* FS info for spool directory */
|
||||
double spoolsize; /* FS size */
|
||||
#endif /* HAVE_STATFS */
|
||||
static const int nups[] = /* number-up-supported values */
|
||||
{ 1, 2, 4, 6, 9, 16 };
|
||||
static const int orients[4] =/* orientation-requested-supported values */
|
||||
@@ -420,6 +445,7 @@ cupsdCreateCommonData(void)
|
||||
"multiple-document-handling",
|
||||
"number-up",
|
||||
"output-bin",
|
||||
"output-mode",
|
||||
"orientation-requested",
|
||||
"page-ranges",
|
||||
"print-quality",
|
||||
@@ -438,6 +464,7 @@ cupsdCreateCommonData(void)
|
||||
"multiple-document-handling",
|
||||
"number-up",
|
||||
"output-bin",
|
||||
"output-mode",
|
||||
"orientation-requested",
|
||||
"page-ranges",
|
||||
"print-quality",
|
||||
@@ -456,6 +483,34 @@ cupsdCreateCommonData(void)
|
||||
|
||||
CommonData = ippNew();
|
||||
|
||||
/*
|
||||
* Get the maximum spool size based on the size of the filesystem used for
|
||||
* the RequestRoot directory. If the host OS doesn't support the statfs call
|
||||
* or the filesystem is larger than 2TiB, always report INT_MAX.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_STATFS
|
||||
if (statfs(RequestRoot, &spoolinfo))
|
||||
k_supported = INT_MAX;
|
||||
else if ((spoolsize = (double)spoolinfo.f_bsize * spoolinfo.f_blocks / 1024) >
|
||||
INT_MAX)
|
||||
k_supported = INT_MAX;
|
||||
else
|
||||
k_supported = (int)spoolsize;
|
||||
|
||||
#elif defined(HAVE_STATVFS)
|
||||
if (statvfs(RequestRoot, &spoolinfo))
|
||||
k_supported = INT_MAX;
|
||||
else if ((spoolsize = (double)spoolinfo.f_frsize * spoolinfo.f_blocks / 1024) >
|
||||
INT_MAX)
|
||||
k_supported = INT_MAX;
|
||||
else
|
||||
k_supported = (int)spoolsize;
|
||||
|
||||
#else
|
||||
k_supported = INT_MAX;
|
||||
#endif /* HAVE_STATFS */
|
||||
|
||||
/*
|
||||
* This list of attributes is sorted to improve performance when the
|
||||
* client provides a requested-attributes attribute...
|
||||
@@ -649,9 +704,9 @@ cupsdCreateCommonData(void)
|
||||
/* page-ranges-supported */
|
||||
ippAddBoolean(CommonData, IPP_TAG_PRINTER, "page-ranges-supported", 1);
|
||||
|
||||
/* pdf-override-supported */
|
||||
/* pdl-override-supported */
|
||||
ippAddString(CommonData, IPP_TAG_PRINTER, IPP_TAG_KEYWORD | IPP_TAG_COPY,
|
||||
"pdl-override-supported", NULL, "not-attempted");
|
||||
"pdl-override-supported", NULL, "attempted");
|
||||
|
||||
/* printer-op-policy-supported */
|
||||
attr = ippAddStrings(CommonData, IPP_TAG_PRINTER, IPP_TAG_NAME | IPP_TAG_COPY,
|
||||
@@ -1550,7 +1605,7 @@ cupsdSaveAllPrinters(void)
|
||||
*/
|
||||
|
||||
fchown(cupsFileNumber(fp), getuid(), Group);
|
||||
fchmod(cupsFileNumber(fp), 0600);
|
||||
fchmod(cupsFileNumber(fp), ConfigFilePerm & 0600);
|
||||
|
||||
/*
|
||||
* Write a small header to the file...
|
||||
@@ -2670,8 +2725,8 @@ cupsdSetPrinterAttrs(cupsd_printer_t *p)/* I - Printer to setup */
|
||||
|
||||
int /* O - 1 if something changed, 0 otherwise */
|
||||
cupsdSetPrinterReasons(
|
||||
cupsd_printer_t *p, /* I - Printer */
|
||||
const char *s) /* I - Reasons strings */
|
||||
cupsd_printer_t *p, /* I - Printer */
|
||||
const char *s) /* I - Reasons strings */
|
||||
{
|
||||
int i, /* Looping var */
|
||||
changed = 0; /* Did something change? */
|
||||
@@ -3988,11 +4043,11 @@ load_ppd(cupsd_printer_t *p) /* I - Printer */
|
||||
* Check to see if the cache is up-to-date...
|
||||
*/
|
||||
|
||||
snprintf(cache_name, sizeof(cache_name), "%s/%s.ipp2", CacheDir, p->name);
|
||||
snprintf(cache_name, sizeof(cache_name), "%s/%s.ipp4", CacheDir, p->name);
|
||||
if (stat(cache_name, &cache_info))
|
||||
cache_info.st_mtime = 0;
|
||||
|
||||
snprintf(pwg_name, sizeof(pwg_name), "%s/%s.pwg", CacheDir, p->name);
|
||||
snprintf(pwg_name, sizeof(pwg_name), "%s/%s.pwg3", CacheDir, p->name);
|
||||
if (stat(pwg_name, &pwg_info))
|
||||
pwg_info.st_mtime = 0;
|
||||
|
||||
@@ -4473,10 +4528,18 @@ load_ppd(cupsd_printer_t *p) /* I - Printer */
|
||||
ippAddString(p->ppd_attrs, IPP_TAG_PRINTER, IPP_TAG_KEYWORD,
|
||||
"output-bin-default", NULL, p->pwg->bins[0].pwg);
|
||||
}
|
||||
else if ((ppd_attr = ppdFindAttr(ppd, "DefaultOutputOrder",
|
||||
else if (((ppd_attr = ppdFindAttr(ppd, "DefaultOutputOrder",
|
||||
NULL)) != NULL &&
|
||||
!strcasecmp(ppd_attr->value, "Reverse"))
|
||||
!strcasecmp(ppd_attr->value, "Reverse")) ||
|
||||
(!ppd_attr && ppd->manufacturer && /* "Compatibility heuristic" */
|
||||
(!strcasecmp(ppd->manufacturer, "epson") ||
|
||||
!strcasecmp(ppd->manufacturer, "lexmark"))))
|
||||
{
|
||||
/*
|
||||
* Report that this printer has a single output bin that leaves pages face
|
||||
* up.
|
||||
*/
|
||||
|
||||
ippAddString(p->ppd_attrs, IPP_TAG_PRINTER, IPP_TAG_KEYWORD,
|
||||
"output-bin-supported", NULL, "face-up");
|
||||
ippAddString(p->ppd_attrs, IPP_TAG_PRINTER, IPP_TAG_KEYWORD,
|
||||
@@ -4490,6 +4553,31 @@ load_ppd(cupsd_printer_t *p) /* I - Printer */
|
||||
"output-bin-default", NULL, "face-down");
|
||||
}
|
||||
|
||||
/*
|
||||
* output-mode...
|
||||
*/
|
||||
|
||||
if (ppd->color_device)
|
||||
{
|
||||
static const char * const output_modes[] =
|
||||
{
|
||||
"monochrome",
|
||||
"color"
|
||||
};
|
||||
|
||||
ippAddStrings(p->ppd_attrs, IPP_TAG_PRINTER, IPP_TAG_KEYWORD,
|
||||
"output-mode-supported", 2, NULL, output_modes);
|
||||
ippAddString(p->ppd_attrs, IPP_TAG_PRINTER, IPP_TAG_KEYWORD,
|
||||
"output-mode-default", NULL, "color");
|
||||
}
|
||||
else
|
||||
{
|
||||
ippAddString(p->ppd_attrs, IPP_TAG_PRINTER, IPP_TAG_KEYWORD,
|
||||
"output-mode-supported", NULL, "monochrome");
|
||||
ippAddString(p->ppd_attrs, IPP_TAG_PRINTER, IPP_TAG_KEYWORD,
|
||||
"output-mode-default", NULL, "monochrome");
|
||||
}
|
||||
|
||||
/*
|
||||
* Printer resolutions...
|
||||
*/
|
||||
@@ -4523,7 +4611,7 @@ load_ppd(cupsd_printer_t *p) /* I - Printer */
|
||||
cupsdLogMessage(CUPSD_LOG_WARN,
|
||||
"Bad resolution \"%s\" for printer %s.",
|
||||
choice->choice, p->name);
|
||||
xdpi = ydpi = 72;
|
||||
xdpi = ydpi = 300;
|
||||
}
|
||||
|
||||
attr->values[i].resolution.xres = xdpi;
|
||||
@@ -4557,7 +4645,7 @@ load_ppd(cupsd_printer_t *p) /* I - Printer */
|
||||
cupsdLogMessage(CUPSD_LOG_WARN,
|
||||
"Bad default resolution \"%s\" for printer %s.",
|
||||
ppd_attr->value, p->name);
|
||||
xdpi = ydpi = 72;
|
||||
xdpi = ydpi = 300;
|
||||
}
|
||||
|
||||
ippAddResolution(p->ppd_attrs, IPP_TAG_PRINTER,
|
||||
@@ -4575,16 +4663,18 @@ load_ppd(cupsd_printer_t *p) /* I - Printer */
|
||||
|
||||
ippAddResolution(p->ppd_attrs, IPP_TAG_PRINTER,
|
||||
"printer-resolution-default", IPP_RES_PER_INCH,
|
||||
72, 72);
|
||||
300, 300);
|
||||
ippAddResolution(p->ppd_attrs, IPP_TAG_PRINTER,
|
||||
"printer-resolution-supported", IPP_RES_PER_INCH,
|
||||
72, 72);
|
||||
300, 300);
|
||||
}
|
||||
|
||||
/*
|
||||
* Duplexing, etc...
|
||||
*/
|
||||
|
||||
ppdMarkDefaults(ppd);
|
||||
|
||||
if ((duplex = ppdFindOption(ppd, "Duplex")) == NULL)
|
||||
if ((duplex = ppdFindOption(ppd, "EFDuplex")) == NULL)
|
||||
if ((duplex = ppdFindOption(ppd, "EFDuplexing")) == NULL)
|
||||
@@ -4846,6 +4936,129 @@ load_ppd(cupsd_printer_t *p) /* I - Printer */
|
||||
if (ppdFindAttr(ppd, "APRemoteQueueID", NULL))
|
||||
p->type |= CUPS_PRINTER_REMOTE;
|
||||
|
||||
#ifdef HAVE_APPLICATIONSERVICES_H
|
||||
/*
|
||||
* Convert the file referenced in APPrinterIconPath to a 128x128 PNG
|
||||
* and save it as cacheDir/printername.png
|
||||
*/
|
||||
|
||||
if ((ppd_attr = ppdFindAttr(ppd, "APPrinterIconPath", NULL)) != NULL &&
|
||||
ppd_attr->value)
|
||||
{
|
||||
CGImageRef imageRef = NULL;/* Current icon image */
|
||||
CGImageRef biggestIconRef = NULL;
|
||||
/* Biggest icon image */
|
||||
CGImageRef closestTo128IconRef = NULL;
|
||||
/* Icon image closest to and >= 128 */
|
||||
CGImageSourceRef sourceRef; /* The file's image source */
|
||||
char outPath[HTTP_MAX_URI];
|
||||
/* The path to the PNG file */
|
||||
CFURLRef outUrl; /* The URL made from the outPath */
|
||||
CFURLRef icnsFileUrl; /* The URL of the original ICNS icon file */
|
||||
CGImageDestinationRef destRef; /* The image destination to write */
|
||||
size_t bytesPerRow; /* The bytes per row used for resizing */
|
||||
CGContextRef context; /* The CG context used for resizing */
|
||||
|
||||
snprintf(outPath, sizeof(outPath), "%s/%s.png", CacheDir, p->name);
|
||||
outUrl = CFURLCreateFromFileSystemRepresentation(kCFAllocatorDefault,
|
||||
(UInt8 *)outPath,
|
||||
strlen(outPath),
|
||||
FALSE);
|
||||
icnsFileUrl = CFURLCreateFromFileSystemRepresentation(kCFAllocatorDefault,
|
||||
(UInt8 *)ppd_attr->value,
|
||||
strlen(ppd_attr->value),
|
||||
FALSE);
|
||||
if (outUrl && icnsFileUrl)
|
||||
{
|
||||
sourceRef = CGImageSourceCreateWithURL(icnsFileUrl, NULL);
|
||||
if (sourceRef)
|
||||
{
|
||||
for (i = 0; i < CGImageSourceGetCount(sourceRef); i ++)
|
||||
{
|
||||
imageRef = CGImageSourceCreateImageAtIndex(sourceRef, i, NULL);
|
||||
if (imageRef &&
|
||||
CGImageGetWidth(imageRef) == CGImageGetHeight(imageRef))
|
||||
{
|
||||
/*
|
||||
* Loop through remembering the icon closest to 128 but >= 128
|
||||
* and then remember the largest icon.
|
||||
*/
|
||||
|
||||
if (CGImageGetWidth(imageRef) >= 128 &&
|
||||
(!closestTo128IconRef ||
|
||||
CGImageGetWidth(imageRef) <
|
||||
CGImageGetWidth(closestTo128IconRef)))
|
||||
{
|
||||
CGImageRelease(closestTo128IconRef);
|
||||
CGImageRetain(imageRef);
|
||||
closestTo128IconRef = imageRef;
|
||||
}
|
||||
|
||||
if (!biggestIconRef ||
|
||||
CGImageGetWidth(imageRef) > CGImageGetWidth(biggestIconRef))
|
||||
{
|
||||
CGImageRelease(biggestIconRef);
|
||||
CGImageRetain(imageRef);
|
||||
biggestIconRef = imageRef;
|
||||
}
|
||||
|
||||
CGImageRelease(imageRef);
|
||||
}
|
||||
}
|
||||
|
||||
if (biggestIconRef)
|
||||
{
|
||||
/*
|
||||
* If biggestIconRef is NULL, we found no icons. Otherwise we first
|
||||
* want the closest to 128, but if none are larger than 128, we want
|
||||
* the largest icon available.
|
||||
*/
|
||||
|
||||
imageRef = closestTo128IconRef ? closestTo128IconRef :
|
||||
biggestIconRef;
|
||||
CGImageRetain(imageRef);
|
||||
CGImageRelease(biggestIconRef);
|
||||
CGImageRelease(closestTo128IconRef);
|
||||
destRef = CGImageDestinationCreateWithURL(outUrl, kUTTypePNG, 1,
|
||||
NULL);
|
||||
if (destRef)
|
||||
{
|
||||
if (CGImageGetWidth(imageRef) != 128)
|
||||
{
|
||||
bytesPerRow = CGImageGetBytesPerRow(imageRef) /
|
||||
CGImageGetWidth(imageRef) * 128;
|
||||
context = CGBitmapContextCreate(NULL, 128, 128,
|
||||
CGImageGetBitsPerComponent(imageRef),
|
||||
bytesPerRow,
|
||||
CGImageGetColorSpace(imageRef),
|
||||
kCGImageAlphaPremultipliedFirst);
|
||||
if (context)
|
||||
{
|
||||
CGContextDrawImage(context, CGRectMake(0, 0, 128, 128),
|
||||
imageRef);
|
||||
CGImageRelease(imageRef);
|
||||
imageRef = CGBitmapContextCreateImage(context);
|
||||
CGContextRelease(context);
|
||||
}
|
||||
}
|
||||
|
||||
CGImageDestinationAddImage(destRef, imageRef, NULL);
|
||||
CGImageDestinationFinalize(destRef);
|
||||
CFRelease(destRef);
|
||||
}
|
||||
|
||||
CGImageRelease(imageRef);
|
||||
}
|
||||
|
||||
CFRelease(sourceRef);
|
||||
CFRelease(icnsFileUrl);
|
||||
}
|
||||
|
||||
CFRelease(outUrl);
|
||||
}
|
||||
}
|
||||
#endif /* HAVE_APPLICATIONSERVICES_H */
|
||||
|
||||
/*
|
||||
* Close the PPD and set the type...
|
||||
*/
|
||||
|
||||
@@ -224,6 +224,7 @@ export_dest(http_t *http, /* I - Connection to server */
|
||||
int status; /* Status of export */
|
||||
char ppdfile[1024], /* PPD file for printer drivers */
|
||||
prompt[1024]; /* Password prompt */
|
||||
int tries; /* Number of tries */
|
||||
|
||||
|
||||
/*
|
||||
@@ -243,7 +244,7 @@ export_dest(http_t *http, /* I - Connection to server */
|
||||
* Try to export it...
|
||||
*/
|
||||
|
||||
for (status = 0; !status;)
|
||||
for (status = 0, tries = 0; !status && tries < 3; tries ++)
|
||||
{
|
||||
/*
|
||||
* Get the password, as needed...
|
||||
|
||||
+85
-670
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
* "$Id$"
|
||||
*
|
||||
* "lpadmin" command for the Common UNIX Printing System (CUPS).
|
||||
* "lpadmin" command for CUPS.
|
||||
*
|
||||
* Copyright 2007-2009 by Apple Inc.
|
||||
* Copyright 2007-2010 by Apple Inc.
|
||||
* Copyright 1997-2006 by Easy Software Products.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
@@ -17,17 +17,12 @@
|
||||
* main() - Parse options and configure the scheduler.
|
||||
* add_printer_to_class() - Add a printer to a class.
|
||||
* default_printer() - Set the default printing destination.
|
||||
* delete_printer() - Delete a printer from the system...
|
||||
* delete_printer() - Delete a printer from the system.
|
||||
* delete_printer_from_class() - Delete a printer from a class.
|
||||
* enable_printer() - Enable a printer...
|
||||
* set_printer_device() - Set the device-uri attribute.
|
||||
* set_printer_file() - Set the interface script or PPD file.
|
||||
* set_printer_info() - Set the printer description string.
|
||||
* set_printer_location() - Set the printer location string.
|
||||
* set_printer_model() - Set the driver model file.
|
||||
* set_printer_options() - Set the printer options.
|
||||
* enable_printer() - Enable a printer.
|
||||
* set_printer_options() - Set the printer options and/or file.
|
||||
* validate_name() - Make sure the printer name only contains
|
||||
* valid chars...
|
||||
* valid chars.
|
||||
*/
|
||||
|
||||
/*
|
||||
@@ -42,28 +37,22 @@
|
||||
#include <cups/cups.h>
|
||||
#include <cups/i18n.h>
|
||||
#include <cups/debug.h>
|
||||
#ifdef HAVE_LIBZ
|
||||
# include <zlib.h>
|
||||
#endif /* HAVE_LIBZ */
|
||||
|
||||
|
||||
/*
|
||||
* Local functions...
|
||||
*/
|
||||
|
||||
static int add_printer_to_class(http_t *, char *, char *);
|
||||
static int default_printer(http_t *, char *);
|
||||
static int delete_printer(http_t *, char *);
|
||||
static int delete_printer_from_class(http_t *, char *, char *);
|
||||
static int enable_printer(http_t *, char *);
|
||||
static char *get_line(char *, int, FILE *fp);
|
||||
static int set_printer_device(http_t *, char *, char *);
|
||||
static int set_printer_file(http_t *, char *, char *);
|
||||
static int set_printer_info(http_t *, char *, char *);
|
||||
static int set_printer_location(http_t *, char *, char *);
|
||||
static int set_printer_model(http_t *, char *, char *);
|
||||
static int set_printer_options(http_t *, char *, int, cups_option_t *);
|
||||
static int validate_name(const char *);
|
||||
static int add_printer_to_class(http_t *http, char *printer, char *pclass);
|
||||
static int default_printer(http_t *http, char *printer);
|
||||
static int delete_printer(http_t *http, char *printer);
|
||||
static int delete_printer_from_class(http_t *http, char *printer,
|
||||
char *pclass);
|
||||
static int enable_printer(http_t *http, char *printer);
|
||||
static int set_printer_options(http_t *http, char *printer,
|
||||
int num_options, cups_option_t *options,
|
||||
char *file);
|
||||
static int validate_name(const char *name);
|
||||
|
||||
|
||||
/*
|
||||
@@ -81,6 +70,7 @@ main(int argc, /* I - Number of command-line arguments */
|
||||
*val; /* Pointer to allow/deny value */
|
||||
int num_options; /* Number of options */
|
||||
cups_option_t *options; /* Options */
|
||||
char *file; /* New PPD file/interface script */
|
||||
|
||||
|
||||
_cupsSetLocale(argv);
|
||||
@@ -89,6 +79,7 @@ main(int argc, /* I - Number of command-line arguments */
|
||||
printer = NULL;
|
||||
num_options = 0;
|
||||
options = NULL;
|
||||
file = NULL;
|
||||
|
||||
for (i = 1; i < argc; i ++)
|
||||
if (argv[i][0] == '-')
|
||||
@@ -219,34 +210,8 @@ main(int argc, /* I - Number of command-line arguments */
|
||||
break;
|
||||
|
||||
case 'i' : /* Use the specified interface script */
|
||||
if (!http)
|
||||
{
|
||||
http = httpConnectEncrypt(cupsServer(), ippPort(),
|
||||
cupsEncryption());
|
||||
|
||||
if (http == NULL)
|
||||
{
|
||||
_cupsLangPrintf(stderr,
|
||||
_("lpadmin: Unable to connect to server: %s\n"),
|
||||
strerror(errno));
|
||||
return (1);
|
||||
}
|
||||
}
|
||||
|
||||
if (printer == NULL)
|
||||
{
|
||||
_cupsLangPuts(stderr,
|
||||
_("lpadmin: Unable to set the interface script:\n"
|
||||
" You must specify a printer name "
|
||||
"first!\n"));
|
||||
return (1);
|
||||
}
|
||||
|
||||
if (argv[i][2])
|
||||
{
|
||||
if (set_printer_file(http, printer, argv[i] + 2))
|
||||
return (1);
|
||||
}
|
||||
file = argv[i] + 2;
|
||||
else
|
||||
{
|
||||
i ++;
|
||||
@@ -259,8 +224,7 @@ main(int argc, /* I - Number of command-line arguments */
|
||||
return (1);
|
||||
}
|
||||
|
||||
if (set_printer_file(http, printer, argv[i]))
|
||||
return (1);
|
||||
file = argv[i];
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -299,35 +263,9 @@ main(int argc, /* I - Number of command-line arguments */
|
||||
break;
|
||||
|
||||
case 'm' : /* Use the specified standard script/PPD file */
|
||||
if (!http)
|
||||
{
|
||||
http = httpConnectEncrypt(cupsServer(), ippPort(),
|
||||
cupsEncryption());
|
||||
|
||||
if (http == NULL)
|
||||
{
|
||||
_cupsLangPrintf(stderr,
|
||||
_("lpadmin: Unable to connect to server: %s\n"),
|
||||
strerror(errno));
|
||||
return (1);
|
||||
}
|
||||
}
|
||||
|
||||
if (printer == NULL)
|
||||
{
|
||||
_cupsLangPuts(stderr,
|
||||
_("lpadmin: Unable to set the interface script or "
|
||||
"PPD file:\n"
|
||||
" You must specify a printer name "
|
||||
"first!\n"));
|
||||
return (1);
|
||||
}
|
||||
|
||||
if (argv[i][2])
|
||||
{
|
||||
if (set_printer_model(http, printer, argv[i] + 2))
|
||||
return (1);
|
||||
}
|
||||
num_options = cupsAddOption("ppd-name", argv[i] + 2, num_options,
|
||||
&options);
|
||||
else
|
||||
{
|
||||
i ++;
|
||||
@@ -340,8 +278,8 @@ main(int argc, /* I - Number of command-line arguments */
|
||||
return (1);
|
||||
}
|
||||
|
||||
if (set_printer_model(http, printer, argv[i]))
|
||||
return (1);
|
||||
num_options = cupsAddOption("ppd-name", argv[i], num_options,
|
||||
&options);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -365,20 +303,6 @@ main(int argc, /* I - Number of command-line arguments */
|
||||
break;
|
||||
|
||||
case 'p' : /* Add/modify a printer */
|
||||
if (!http)
|
||||
{
|
||||
http = httpConnectEncrypt(cupsServer(), ippPort(),
|
||||
cupsEncryption());
|
||||
|
||||
if (http == NULL)
|
||||
{
|
||||
_cupsLangPrintf(stderr,
|
||||
_("lpadmin: Unable to connect to server: %s\n"),
|
||||
strerror(errno));
|
||||
return (1);
|
||||
}
|
||||
}
|
||||
|
||||
if (argv[i][2])
|
||||
printer = argv[i] + 2;
|
||||
else
|
||||
@@ -512,34 +436,9 @@ main(int argc, /* I - Number of command-line arguments */
|
||||
break;
|
||||
|
||||
case 'v' : /* Set the device-uri attribute */
|
||||
if (!http)
|
||||
{
|
||||
http = httpConnectEncrypt(cupsServer(), ippPort(),
|
||||
cupsEncryption());
|
||||
|
||||
if (http == NULL)
|
||||
{
|
||||
_cupsLangPrintf(stderr,
|
||||
_("lpadmin: Unable to connect to server: %s\n"),
|
||||
strerror(errno));
|
||||
return (1);
|
||||
}
|
||||
}
|
||||
|
||||
if (printer == NULL)
|
||||
{
|
||||
_cupsLangPuts(stderr,
|
||||
_("lpadmin: Unable to set the device URI:\n"
|
||||
" You must specify a printer name "
|
||||
"first!\n"));
|
||||
return (1);
|
||||
}
|
||||
|
||||
if (argv[i][2])
|
||||
{
|
||||
if (set_printer_device(http, printer, argv[i] + 2))
|
||||
return (1);
|
||||
}
|
||||
num_options = cupsAddOption("device-uri", argv[i] + 2,
|
||||
num_options, &options);
|
||||
else
|
||||
{
|
||||
i ++;
|
||||
@@ -552,8 +451,8 @@ main(int argc, /* I - Number of command-line arguments */
|
||||
return (1);
|
||||
}
|
||||
|
||||
if (set_printer_device(http, printer, argv[i]))
|
||||
return (1);
|
||||
num_options = cupsAddOption("device-uri", argv[i],
|
||||
num_options, &options);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -604,35 +503,9 @@ main(int argc, /* I - Number of command-line arguments */
|
||||
break;
|
||||
|
||||
case 'D' : /* Set the printer-info attribute */
|
||||
if (!http)
|
||||
{
|
||||
http = httpConnectEncrypt(cupsServer(), ippPort(),
|
||||
cupsEncryption());
|
||||
|
||||
if (http == NULL)
|
||||
{
|
||||
_cupsLangPrintf(stderr,
|
||||
_("lpadmin: Unable to connect to server: %s\n"),
|
||||
strerror(errno));
|
||||
return (1);
|
||||
}
|
||||
}
|
||||
|
||||
if (printer == NULL)
|
||||
{
|
||||
_cupsLangPuts(stderr,
|
||||
_("lpadmin: Unable to set the printer "
|
||||
"description:\n"
|
||||
" You must specify a printer name "
|
||||
"first!\n"));
|
||||
return (1);
|
||||
}
|
||||
|
||||
if (argv[i][2])
|
||||
{
|
||||
if (set_printer_info(http, printer, argv[i] + 2))
|
||||
return (1);
|
||||
}
|
||||
num_options = cupsAddOption("printer-info", argv[i] + 2,
|
||||
num_options, &options);
|
||||
else
|
||||
{
|
||||
i ++;
|
||||
@@ -645,8 +518,8 @@ main(int argc, /* I - Number of command-line arguments */
|
||||
return (1);
|
||||
}
|
||||
|
||||
if (set_printer_info(http, printer, argv[i]))
|
||||
return (1);
|
||||
num_options = cupsAddOption("printer-info", argv[i],
|
||||
num_options, &options);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -666,34 +539,9 @@ main(int argc, /* I - Number of command-line arguments */
|
||||
break;
|
||||
|
||||
case 'L' : /* Set the printer-location attribute */
|
||||
if (!http)
|
||||
{
|
||||
http = httpConnectEncrypt(cupsServer(), ippPort(),
|
||||
cupsEncryption());
|
||||
|
||||
if (http == NULL)
|
||||
{
|
||||
_cupsLangPrintf(stderr,
|
||||
_("lpadmin: Unable to connect to server: %s\n"),
|
||||
strerror(errno));
|
||||
return (1);
|
||||
}
|
||||
}
|
||||
|
||||
if (printer == NULL)
|
||||
{
|
||||
_cupsLangPuts(stderr,
|
||||
_("lpadmin: Unable to set the printer location:\n"
|
||||
" You must specify a printer name "
|
||||
"first!\n"));
|
||||
return (1);
|
||||
}
|
||||
|
||||
if (argv[i][2])
|
||||
{
|
||||
if (set_printer_location(http, printer, argv[i] + 2))
|
||||
return (1);
|
||||
}
|
||||
num_options = cupsAddOption("printer-location", argv[i] + 2,
|
||||
num_options, &options);
|
||||
else
|
||||
{
|
||||
i ++;
|
||||
@@ -706,40 +554,14 @@ main(int argc, /* I - Number of command-line arguments */
|
||||
return (1);
|
||||
}
|
||||
|
||||
if (set_printer_location(http, printer, argv[i]))
|
||||
return (1);
|
||||
num_options = cupsAddOption("printer-location", argv[i],
|
||||
num_options, &options);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'P' : /* Use the specified PPD file */
|
||||
if (!http)
|
||||
{
|
||||
http = httpConnectEncrypt(cupsServer(), ippPort(),
|
||||
cupsEncryption());
|
||||
|
||||
if (http == NULL)
|
||||
{
|
||||
_cupsLangPrintf(stderr,
|
||||
_("lpadmin: Unable to connect to server: %s\n"),
|
||||
strerror(errno));
|
||||
return (1);
|
||||
}
|
||||
}
|
||||
|
||||
if (printer == NULL)
|
||||
{
|
||||
_cupsLangPuts(stderr,
|
||||
_("lpadmin: Unable to set the PPD file:\n"
|
||||
" You must specify a printer name "
|
||||
"first!\n"));
|
||||
return (1);
|
||||
}
|
||||
|
||||
if (argv[i][2])
|
||||
{
|
||||
if (set_printer_file(http, printer, argv[i] + 2))
|
||||
return (1);
|
||||
}
|
||||
file = argv[i] + 2;
|
||||
else
|
||||
{
|
||||
i ++;
|
||||
@@ -751,8 +573,7 @@ main(int argc, /* I - Number of command-line arguments */
|
||||
return (1);
|
||||
}
|
||||
|
||||
if (set_printer_file(http, printer, argv[i]))
|
||||
return (1);
|
||||
file = argv[i];
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -772,7 +593,7 @@ main(int argc, /* I - Number of command-line arguments */
|
||||
* Set options as needed...
|
||||
*/
|
||||
|
||||
if (num_options)
|
||||
if (num_options || file)
|
||||
{
|
||||
if (!http)
|
||||
{
|
||||
@@ -795,7 +616,7 @@ main(int argc, /* I - Number of command-line arguments */
|
||||
return (1);
|
||||
}
|
||||
|
||||
if (set_printer_options(http, printer, num_options, options))
|
||||
if (set_printer_options(http, printer, num_options, options, file))
|
||||
return (1);
|
||||
}
|
||||
|
||||
@@ -1288,429 +1109,6 @@ enable_printer(http_t *http, /* I - Server connection */
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'get_line()' - Get a line that is terminated by a LF, CR, or CR LF.
|
||||
*/
|
||||
|
||||
static char * /* O - Pointer to buf or NULL on EOF */
|
||||
get_line(char *buf, /* I - Line buffer */
|
||||
int length, /* I - Length of buffer */
|
||||
FILE *fp) /* I - File to read from */
|
||||
{
|
||||
char *bufptr; /* Pointer into buffer */
|
||||
int ch; /* Character from file */
|
||||
|
||||
|
||||
length --;
|
||||
bufptr = buf;
|
||||
|
||||
while ((ch = getc(fp)) != EOF)
|
||||
{
|
||||
if (ch == '\n')
|
||||
break;
|
||||
else if (ch == '\r')
|
||||
{
|
||||
/*
|
||||
* Look for LF...
|
||||
*/
|
||||
|
||||
ch = getc(fp);
|
||||
if (ch != '\n' && ch != EOF)
|
||||
ungetc(ch, fp);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
*bufptr++ = ch;
|
||||
length --;
|
||||
if (length == 0)
|
||||
break;
|
||||
}
|
||||
|
||||
*bufptr = '\0';
|
||||
|
||||
if (ch == EOF)
|
||||
return (NULL);
|
||||
else
|
||||
return (buf);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'set_printer_device()' - Set the device-uri attribute.
|
||||
*/
|
||||
|
||||
static int /* O - 0 on success, 1 on fail */
|
||||
set_printer_device(http_t *http, /* I - Server connection */
|
||||
char *printer, /* I - Printer */
|
||||
char *device) /* I - New device URI */
|
||||
{
|
||||
ipp_t *request, /* IPP Request */
|
||||
*response; /* IPP Response */
|
||||
char uri[HTTP_MAX_URI]; /* URI for printer/class */
|
||||
|
||||
|
||||
DEBUG_printf(("set_printer_device(%p, \"%s\", \"%s\")\n", http, printer,
|
||||
device));
|
||||
|
||||
/*
|
||||
* Build a CUPS_ADD_PRINTER request, which requires the following
|
||||
* attributes:
|
||||
*
|
||||
* attributes-charset
|
||||
* attributes-natural-language
|
||||
* printer-uri
|
||||
*/
|
||||
|
||||
request = ippNewRequest(CUPS_ADD_PRINTER);
|
||||
|
||||
httpAssembleURIf(HTTP_URI_CODING_ALL, uri, sizeof(uri), "ipp", NULL,
|
||||
"localhost", 0, "/printers/%s", printer);
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI,
|
||||
"printer-uri", NULL, uri);
|
||||
|
||||
/*
|
||||
* Add the device URI...
|
||||
*/
|
||||
|
||||
if (device[0] == '/')
|
||||
{
|
||||
/*
|
||||
* Convert filename to URI...
|
||||
*/
|
||||
|
||||
snprintf(uri, sizeof(uri), "file://%s", device);
|
||||
ippAddString(request, IPP_TAG_PRINTER, IPP_TAG_URI, "device-uri", NULL,
|
||||
uri);
|
||||
}
|
||||
else
|
||||
ippAddString(request, IPP_TAG_PRINTER, IPP_TAG_URI, "device-uri", NULL,
|
||||
device);
|
||||
|
||||
/*
|
||||
* Do the request and get back a response...
|
||||
*/
|
||||
|
||||
if ((response = cupsDoRequest(http, request, "/admin/")) == NULL)
|
||||
{
|
||||
_cupsLangPrintf(stderr, "lpadmin: %s\n", cupsLastErrorString());
|
||||
|
||||
return (1);
|
||||
}
|
||||
else if (response->request.status.status_code > IPP_OK_CONFLICT)
|
||||
{
|
||||
_cupsLangPrintf(stderr, "lpadmin: %s\n", cupsLastErrorString());
|
||||
|
||||
ippDelete(response);
|
||||
|
||||
return (1);
|
||||
}
|
||||
else
|
||||
{
|
||||
ippDelete(response);
|
||||
|
||||
return (0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'set_printer_file()' - Set the interface script or PPD file.
|
||||
*/
|
||||
|
||||
static int /* O - 0 on success, 1 on fail */
|
||||
set_printer_file(http_t *http, /* I - Server connection */
|
||||
char *printer, /* I - Printer */
|
||||
char *file) /* I - PPD file or interface script */
|
||||
{
|
||||
ipp_t *request, /* IPP Request */
|
||||
*response; /* IPP Response */
|
||||
char uri[HTTP_MAX_URI]; /* URI for printer/class */
|
||||
#ifdef HAVE_LIBZ
|
||||
char tempfile[1024]; /* Temporary filename */
|
||||
int fd; /* Temporary file */
|
||||
gzFile *gz; /* GZIP'd file */
|
||||
char buffer[8192]; /* Copy buffer */
|
||||
int bytes; /* Bytes in buffer */
|
||||
|
||||
|
||||
DEBUG_printf(("set_printer_file(%p, \"%s\", \"%s\")\n", http, printer,
|
||||
file));
|
||||
|
||||
/*
|
||||
* See if the file is gzip'd; if so, unzip it to a temporary file and
|
||||
* send the uncompressed file.
|
||||
*/
|
||||
|
||||
if (!strcmp(file + strlen(file) - 3, ".gz"))
|
||||
{
|
||||
/*
|
||||
* Yes, the file is compressed; uncompress to a temp file...
|
||||
*/
|
||||
|
||||
if ((fd = cupsTempFd(tempfile, sizeof(tempfile))) < 0)
|
||||
{
|
||||
_cupsLangPrintError(_("ERROR: Unable to create temporary file"));
|
||||
return (1);
|
||||
}
|
||||
|
||||
if ((gz = gzopen(file, "rb")) == NULL)
|
||||
{
|
||||
_cupsLangPrintf(stderr,
|
||||
_("lpadmin: Unable to open file \"%s\": %s\n"),
|
||||
file, strerror(errno));
|
||||
close(fd);
|
||||
unlink(tempfile);
|
||||
return (1);
|
||||
}
|
||||
|
||||
while ((bytes = gzread(gz, buffer, sizeof(buffer))) > 0)
|
||||
write(fd, buffer, bytes);
|
||||
|
||||
close(fd);
|
||||
gzclose(gz);
|
||||
|
||||
file = tempfile;
|
||||
}
|
||||
#endif /* HAVE_LIBZ */
|
||||
|
||||
/*
|
||||
* Build a CUPS_ADD_PRINTER request, which requires the following
|
||||
* attributes:
|
||||
*
|
||||
* attributes-charset
|
||||
* attributes-natural-language
|
||||
* printer-uri
|
||||
*/
|
||||
|
||||
request = ippNewRequest(CUPS_ADD_PRINTER);
|
||||
|
||||
httpAssembleURIf(HTTP_URI_CODING_ALL, uri, sizeof(uri), "ipp", NULL,
|
||||
"localhost", 0, "/printers/%s", printer);
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI,
|
||||
"printer-uri", NULL, uri);
|
||||
|
||||
/*
|
||||
* Do the request and get back a response...
|
||||
*/
|
||||
|
||||
response = cupsDoFileRequest(http, request, "/admin/", file);
|
||||
ippDelete(response);
|
||||
|
||||
#ifdef HAVE_LIBZ
|
||||
/*
|
||||
* Remove the temporary file as needed...
|
||||
*/
|
||||
|
||||
if (file == tempfile)
|
||||
unlink(tempfile);
|
||||
#endif /* HAVE_LIBZ */
|
||||
|
||||
if (cupsLastError() > IPP_OK_CONFLICT)
|
||||
{
|
||||
_cupsLangPrintf(stderr, "lpadmin: %s\n", cupsLastErrorString());
|
||||
|
||||
return (1);
|
||||
}
|
||||
else
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'set_printer_info()' - Set the printer description string.
|
||||
*/
|
||||
|
||||
static int /* O - 0 on success, 1 on fail */
|
||||
set_printer_info(http_t *http, /* I - Server connection */
|
||||
char *printer, /* I - Printer */
|
||||
char *info) /* I - New description string */
|
||||
{
|
||||
ipp_t *request, /* IPP Request */
|
||||
*response; /* IPP Response */
|
||||
char uri[HTTP_MAX_URI]; /* URI for printer/class */
|
||||
|
||||
|
||||
DEBUG_printf(("set_printer_info(%p, \"%s\", \"%s\")\n", http, printer,
|
||||
info));
|
||||
|
||||
/*
|
||||
* Build a CUPS_ADD_PRINTER request, which requires the following
|
||||
* attributes:
|
||||
*
|
||||
* attributes-charset
|
||||
* attributes-natural-language
|
||||
* printer-uri
|
||||
*/
|
||||
|
||||
request = ippNewRequest(CUPS_ADD_PRINTER);
|
||||
|
||||
httpAssembleURIf(HTTP_URI_CODING_ALL, uri, sizeof(uri), "ipp", NULL,
|
||||
"localhost", 0, "/printers/%s", printer);
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI,
|
||||
"printer-uri", NULL, uri);
|
||||
|
||||
/*
|
||||
* Add the info string...
|
||||
*/
|
||||
|
||||
ippAddString(request, IPP_TAG_PRINTER, IPP_TAG_TEXT, "printer-info", NULL,
|
||||
info);
|
||||
|
||||
/*
|
||||
* Do the request and get back a response...
|
||||
*/
|
||||
|
||||
if ((response = cupsDoRequest(http, request, "/admin/")) == NULL)
|
||||
{
|
||||
_cupsLangPrintf(stderr, "lpadmin: %s\n", cupsLastErrorString());
|
||||
return (1);
|
||||
}
|
||||
else if (response->request.status.status_code > IPP_OK_CONFLICT)
|
||||
{
|
||||
_cupsLangPrintf(stderr, "lpadmin: %s\n", cupsLastErrorString());
|
||||
|
||||
ippDelete(response);
|
||||
|
||||
return (1);
|
||||
}
|
||||
else
|
||||
{
|
||||
ippDelete(response);
|
||||
|
||||
return (0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'set_printer_location()' - Set the printer location string.
|
||||
*/
|
||||
|
||||
static int /* O - 0 on success, 1 on fail */
|
||||
set_printer_location(http_t *http, /* I - Server connection */
|
||||
char *printer, /* I - Printer */
|
||||
char *location) /* I - New location string */
|
||||
{
|
||||
ipp_t *request, /* IPP Request */
|
||||
*response; /* IPP Response */
|
||||
char uri[HTTP_MAX_URI]; /* URI for printer/class */
|
||||
|
||||
|
||||
DEBUG_printf(("set_printer_location(%p, \"%s\", \"%s\")\n", http, printer,
|
||||
location));
|
||||
|
||||
/*
|
||||
* Build a CUPS_ADD_PRINTER request, which requires the following
|
||||
* attributes:
|
||||
*
|
||||
* attributes-charset
|
||||
* attributes-natural-language
|
||||
* printer-uri
|
||||
*/
|
||||
|
||||
request = ippNewRequest(CUPS_ADD_PRINTER);
|
||||
|
||||
httpAssembleURIf(HTTP_URI_CODING_ALL, uri, sizeof(uri), "ipp", NULL,
|
||||
"localhost", 0, "/printers/%s", printer);
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI,
|
||||
"printer-uri", NULL, uri);
|
||||
|
||||
/*
|
||||
* Add the location string...
|
||||
*/
|
||||
|
||||
ippAddString(request, IPP_TAG_PRINTER, IPP_TAG_TEXT, "printer-location", NULL,
|
||||
location);
|
||||
|
||||
/*
|
||||
* Do the request and get back a response...
|
||||
*/
|
||||
|
||||
if ((response = cupsDoRequest(http, request, "/admin/")) == NULL)
|
||||
{
|
||||
_cupsLangPrintf(stderr, "lpadmin: %s\n", cupsLastErrorString());
|
||||
|
||||
return (1);
|
||||
}
|
||||
else if (response->request.status.status_code > IPP_OK_CONFLICT)
|
||||
{
|
||||
_cupsLangPrintf(stderr, "lpadmin: %s\n", cupsLastErrorString());
|
||||
|
||||
ippDelete(response);
|
||||
|
||||
return (1);
|
||||
}
|
||||
else
|
||||
{
|
||||
ippDelete(response);
|
||||
|
||||
return (0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'set_printer_model()' - Set the driver model file.
|
||||
*/
|
||||
|
||||
static int /* O - 0 on success, 1 on fail */
|
||||
set_printer_model(http_t *http, /* I - Server connection */
|
||||
char *printer, /* I - Printer */
|
||||
char *model) /* I - Driver model file */
|
||||
{
|
||||
ipp_t *request, /* IPP Request */
|
||||
*response; /* IPP Response */
|
||||
char uri[HTTP_MAX_URI]; /* URI for printer/class */
|
||||
|
||||
|
||||
/*
|
||||
* Build a CUPS_ADD_PRINTER request, which requires the following
|
||||
* attributes:
|
||||
*
|
||||
* attributes-charset
|
||||
* attributes-natural-language
|
||||
* printer-uri
|
||||
* ppd-name
|
||||
*/
|
||||
|
||||
request = ippNewRequest(CUPS_ADD_PRINTER);
|
||||
|
||||
httpAssembleURIf(HTTP_URI_CODING_ALL, uri, sizeof(uri), "ipp", NULL,
|
||||
"localhost", 0, "/printers/%s", printer);
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI,
|
||||
"printer-uri", NULL, uri);
|
||||
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME,
|
||||
"ppd-name", NULL, model);
|
||||
|
||||
/*
|
||||
* Do the request and get back a response...
|
||||
*/
|
||||
|
||||
if ((response = cupsDoRequest(http, request, "/admin/")) == NULL)
|
||||
{
|
||||
_cupsLangPrintf(stderr, "lpadmin: %s\n", cupsLastErrorString());
|
||||
|
||||
return (1);
|
||||
}
|
||||
else if (response->request.status.status_code > IPP_OK_CONFLICT)
|
||||
{
|
||||
_cupsLangPrintf(stderr, "lpadmin: %s\n", cupsLastErrorString());
|
||||
|
||||
ippDelete(response);
|
||||
|
||||
return (1);
|
||||
}
|
||||
else
|
||||
{
|
||||
ippDelete(response);
|
||||
|
||||
return (0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'set_printer_options()' - Set the printer options.
|
||||
*/
|
||||
@@ -1720,7 +1118,8 @@ set_printer_options(
|
||||
http_t *http, /* I - Server connection */
|
||||
char *printer, /* I - Printer */
|
||||
int num_options, /* I - Number of options */
|
||||
cups_option_t *options) /* I - Options */
|
||||
cups_option_t *options, /* I - Options */
|
||||
char *file) /* I - PPD file/interface script */
|
||||
{
|
||||
ipp_t *request, /* IPP Request */
|
||||
*response; /* IPP Response */
|
||||
@@ -1735,14 +1134,15 @@ set_printer_options(
|
||||
keyword[1024], /* Keyword from Default line */
|
||||
*keyptr, /* Pointer into keyword... */
|
||||
tempfile[1024]; /* Temporary filename */
|
||||
FILE *in, /* PPD file */
|
||||
cups_file_t *in, /* PPD file */
|
||||
*out; /* Temporary file */
|
||||
int outfd; /* Temporary file descriptor */
|
||||
const char *protocol; /* Old protocol option */
|
||||
const char *protocol, /* Old protocol option */
|
||||
*customval; /* Custom option value */
|
||||
|
||||
|
||||
DEBUG_printf(("set_printer_options(%p, \"%s\", %d, %p)\n", http, printer,
|
||||
num_options, options));
|
||||
DEBUG_printf(("set_printer_options(http=%p, printer=\"%s\", num_options=%d, "
|
||||
"options=%p, file=\"%s\")\n", http, printer, num_options,
|
||||
options, file));
|
||||
|
||||
httpAssembleURIf(HTTP_URI_CODING_ALL, uri, sizeof(uri), "ipp", NULL,
|
||||
"localhost", 0, "/printers/%s", printer);
|
||||
@@ -1761,7 +1161,6 @@ set_printer_options(
|
||||
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI,
|
||||
"printer-uri", NULL, uri);
|
||||
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD,
|
||||
"requested-attributes", NULL, "printer-type");
|
||||
|
||||
@@ -1769,7 +1168,7 @@ set_printer_options(
|
||||
* Do the request...
|
||||
*/
|
||||
|
||||
op = CUPS_ADD_PRINTER;
|
||||
op = CUPS_ADD_MODIFY_PRINTER;
|
||||
|
||||
if ((response = cupsDoRequest(http, request, "/")) != NULL)
|
||||
{
|
||||
@@ -1782,7 +1181,7 @@ set_printer_options(
|
||||
{
|
||||
if (attr->values[0].integer & (CUPS_PRINTER_CLASS | CUPS_PRINTER_IMPLICIT))
|
||||
{
|
||||
op = CUPS_ADD_CLASS;
|
||||
op = CUPS_ADD_MODIFY_CLASS;
|
||||
httpAssembleURIf(HTTP_URI_CODING_ALL, uri, sizeof(uri), "ipp", NULL,
|
||||
"localhost", 0, "/classes/%s", printer);
|
||||
}
|
||||
@@ -1792,8 +1191,8 @@ set_printer_options(
|
||||
}
|
||||
|
||||
/*
|
||||
* Build a CUPS_ADD_PRINTER or CUPS_ADD_CLASS request, which requires
|
||||
* the following attributes:
|
||||
* Build a CUPS_ADD_MODIFY_PRINTER or CUPS_ADD_MODIFY_CLASS request, which
|
||||
* requires the following attributes:
|
||||
*
|
||||
* attributes-charset
|
||||
* attributes-natural-language
|
||||
@@ -1805,6 +1204,8 @@ set_printer_options(
|
||||
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI,
|
||||
"printer-uri", NULL, uri);
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME,
|
||||
"requesting-user-name", NULL, cupsUser());
|
||||
|
||||
/*
|
||||
* Add the options...
|
||||
@@ -1822,7 +1223,9 @@ set_printer_options(
|
||||
NULL, "tbcp");
|
||||
}
|
||||
|
||||
if (op == CUPS_ADD_PRINTER)
|
||||
if (file)
|
||||
ppdfile = file;
|
||||
else if (op == CUPS_ADD_MODIFY_PRINTER)
|
||||
ppdfile = cupsGetPPD(printer);
|
||||
else
|
||||
ppdfile = NULL;
|
||||
@@ -1837,33 +1240,34 @@ set_printer_options(
|
||||
ppdMarkDefaults(ppd);
|
||||
cupsMarkOptions(ppd, num_options, options);
|
||||
|
||||
if ((outfd = cupsTempFd(tempfile, sizeof(tempfile))) < 0)
|
||||
if ((out = cupsTempFile2(tempfile, sizeof(tempfile))) < 0)
|
||||
{
|
||||
_cupsLangPrintError(_("ERROR: Unable to create temporary file"));
|
||||
ippDelete(request);
|
||||
unlink(ppdfile);
|
||||
if (ppdfile != file)
|
||||
unlink(ppdfile);
|
||||
return (1);
|
||||
}
|
||||
|
||||
if ((in = fopen(ppdfile, "rb")) == NULL)
|
||||
if ((in = cupsFileOpen(ppdfile, "r")) == NULL)
|
||||
{
|
||||
_cupsLangPrintf(stderr,
|
||||
_("lpadmin: Unable to open PPD file \"%s\" - %s\n"),
|
||||
ppdfile, strerror(errno));
|
||||
ippDelete(request);
|
||||
unlink(ppdfile);
|
||||
close(outfd);
|
||||
if (ppdfile != file)
|
||||
unlink(ppdfile);
|
||||
cupsFileClose(out);
|
||||
unlink(tempfile);
|
||||
return (1);
|
||||
}
|
||||
|
||||
out = fdopen(outfd, "wb");
|
||||
ppdchanged = 0;
|
||||
|
||||
while (get_line(line, sizeof(line), in) != NULL)
|
||||
while (cupsFileGets(in, line, sizeof(line)))
|
||||
{
|
||||
if (strncmp(line, "*Default", 8))
|
||||
fprintf(out, "%s\n", line);
|
||||
cupsFilePrintf(out, "%s\n", line);
|
||||
else
|
||||
{
|
||||
/*
|
||||
@@ -1893,17 +1297,27 @@ set_printer_options(
|
||||
|
||||
if (choice && strcmp(choice->choice, keyptr))
|
||||
{
|
||||
fprintf(out, "*Default%s: %s\n", keyword, choice->choice);
|
||||
ppdchanged = 1;
|
||||
if (strcmp(choice->choice, "Custom"))
|
||||
{
|
||||
cupsFilePrintf(out, "*Default%s: %s\n", keyword, choice->choice);
|
||||
ppdchanged = 1;
|
||||
}
|
||||
else if ((customval = cupsGetOption(keyword, num_options,
|
||||
options)) != NULL)
|
||||
{
|
||||
cupsFilePrintf(out, "*Default%s: %s\n", keyword, customval);
|
||||
ppdchanged = 1;
|
||||
}
|
||||
else
|
||||
cupsFilePrintf(out, "%s\n", line);
|
||||
}
|
||||
else
|
||||
fprintf(out, "%s\n", line);
|
||||
cupsFilePrintf(out, "%s\n", line);
|
||||
}
|
||||
}
|
||||
|
||||
fclose(in);
|
||||
fclose(out);
|
||||
close(outfd);
|
||||
cupsFileClose(in);
|
||||
cupsFileClose(out);
|
||||
ppdClose(ppd);
|
||||
|
||||
/*
|
||||
@@ -1911,14 +1325,15 @@ set_printer_options(
|
||||
*/
|
||||
|
||||
ippDelete(cupsDoFileRequest(http, request, "/admin/",
|
||||
ppdchanged ? tempfile : NULL));
|
||||
ppdchanged ? tempfile : file));
|
||||
|
||||
/*
|
||||
* Clean up temp files... (TODO: catch signals in case we CTRL-C during
|
||||
* lpadmin)
|
||||
*/
|
||||
|
||||
unlink(ppdfile);
|
||||
if (ppdfile != file)
|
||||
unlink(ppdfile);
|
||||
unlink(tempfile);
|
||||
}
|
||||
else
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
* "$Id$"
|
||||
*
|
||||
* MD5 password program for the Common UNIX Printing System (CUPS).
|
||||
* MD5 password program for CUPS.
|
||||
*
|
||||
* Copyright 2007 by Apple Inc.
|
||||
* Copyright 2007-2010 by Apple Inc.
|
||||
* Copyright 1997-2006 by Easy Software Products.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
|
||||
+12
-15
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
* "$Id$"
|
||||
*
|
||||
* "lpstat" command for the Common UNIX Printing System (CUPS).
|
||||
* "lpstat" command for CUPS.
|
||||
*
|
||||
* Copyright 2007-2008 by Apple Inc.
|
||||
* Copyright 2007-2010 by Apple Inc.
|
||||
* Copyright 1997-2006 by Easy Software Products.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
@@ -34,10 +34,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
#include <cups/http-private.h>
|
||||
#include <cups/string.h>
|
||||
#include <cups/cups.h>
|
||||
#include <cups/i18n.h>
|
||||
#include <cups/globals.h>
|
||||
#include <cups/debug.h>
|
||||
|
||||
|
||||
@@ -1518,7 +1515,7 @@ show_printers(const char *printers, /* I - Destinations */
|
||||
char printer_uri[HTTP_MAX_URI],
|
||||
/* Printer URI */
|
||||
printer_state_time[255];/* Printer state time */
|
||||
const char *root; /* Server root directory... */
|
||||
_cups_globals_t *cg = _cupsGlobals(); /* Global data */
|
||||
static const char *pattrs[] = /* Attributes we need for printers... */
|
||||
{
|
||||
"printer-name",
|
||||
@@ -1536,16 +1533,14 @@ show_printers(const char *printers, /* I - Destinations */
|
||||
};
|
||||
static const char *jattrs[] = /* Attributes we need for jobs... */
|
||||
{
|
||||
"job-id"
|
||||
"job-id",
|
||||
"job-state"
|
||||
};
|
||||
|
||||
|
||||
DEBUG_printf(("show_printers(printers=\"%s\", num_dests=%d, dests=%p, "
|
||||
"long_status=%d)\n", printers, num_dests, dests, long_status));
|
||||
|
||||
if ((root = getenv("CUPS_SERVERROOT")) == NULL)
|
||||
root = CUPS_SERVERROOT;
|
||||
|
||||
if (printers != NULL && !strcmp(printers, "all"))
|
||||
printers = NULL;
|
||||
|
||||
@@ -1820,10 +1815,11 @@ show_printers(const char *printers, /* I - Destinations */
|
||||
if (make_model && strstr(make_model, "System V Printer"))
|
||||
_cupsLangPrintf(stdout,
|
||||
_("\tInterface: %s/interfaces/%s\n"),
|
||||
root, printer);
|
||||
cg->cups_serverroot, printer);
|
||||
else if (make_model && !strstr(make_model, "Raw Printer"))
|
||||
_cupsLangPrintf(stdout,
|
||||
_("\tInterface: %s/ppd/%s.ppd\n"), root, printer);
|
||||
_("\tInterface: %s/ppd/%s.ppd\n"),
|
||||
cg->cups_serverroot, printer);
|
||||
}
|
||||
_cupsLangPuts(stdout, _("\tOn fault: no alert\n"));
|
||||
_cupsLangPuts(stdout, _("\tAfter fault: continue\n"));
|
||||
@@ -1933,10 +1929,11 @@ show_printers(const char *printers, /* I - Destinations */
|
||||
if (make_model && strstr(make_model, "System V Printer"))
|
||||
_cupsLangPrintf(stdout,
|
||||
_("\tInterface: %s/interfaces/%s\n"),
|
||||
root, printer);
|
||||
cg->cups_serverroot, printer);
|
||||
else if (make_model && !strstr(make_model, "Raw Printer"))
|
||||
_cupsLangPrintf(stdout,
|
||||
_("\tInterface: %s/ppd/%s.ppd\n"), root, printer);
|
||||
_("\tInterface: %s/ppd/%s.ppd\n"),
|
||||
cg->cups_serverroot, printer);
|
||||
}
|
||||
_cupsLangPuts(stdout, _("\tOn fault: no alert\n"));
|
||||
_cupsLangPuts(stdout, _("\tAfter fault: continue\n"));
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<DIV CLASS="indent">
|
||||
|
||||
<H2 CLASS="title">>Klasse hinzufügen</H2>
|
||||
<H2 CLASS="title">Klasse hinzufügen</H2>
|
||||
|
||||
<FORM METHOD="POST" ACTION="/admin">
|
||||
<INPUT TYPE="HIDDEN" NAME="org.cups.sid" VALUE="{$org.cups.sid}">
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<INPUT TYPE="HIDDEN" NAME="org.cups.sid" VALUE="{$org.cups.sid}">
|
||||
<INPUT TYPE="HIDDEN" NAME="OP" VALUE="add-rss-subscription">
|
||||
|
||||
<H2 CLASS="title">>RSS Subskription hinzufügen</H2>
|
||||
<H2 CLASS="title">RSS Subskription hinzufügen</H2>
|
||||
|
||||
<TABLE SUMMARY="Forumlar zum Hinzufügen einer RSS Subskription">
|
||||
<TR>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<FORM ACTION="{THIS_URL}" METHOD="GET">
|
||||
<FORM ACTION="/{SECTION}/{?SEARCH_DEST}" METHOD="GET">
|
||||
{WHICH_JOBS?<INPUT TYPE="HIDDEN" NAME="WHICH_JOBS" VALUE="{WHICH_JOBS}">:}
|
||||
{ORDER?<INPUT TYPE="HIDDEN" NAME="ORDER" VALUE="{ORDER}">:}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<DIV CLASS="indent">{?which_jobs=?:<FORM ACTION="{?printer_name=?/jobs:{printer_uri_supported}}" METHOD="GET"><INPUT TYPE="SUBMIT" VALUE="Mostra stampe attive"></FORM>}
|
||||
{?which_jobs=completed?:<FORM ACTION="{?printer_name=?/jobs:{printer_uri_supported}}" METHOD="GET"><INPUT TYPE="HIDDEN" NAME="which_jobs" VALUE="completate"><INPUT TYPE="SUBMIT" VALUE="Mostra stampe completate"></FORM>}
|
||||
{?which_jobs=all?:<FORM ACTION="{?printer_name=?/jobs:{printer_uri_supported}}" METHOD="GET"><INPUT TYPE="HIDDEN" NAME="which_jobs" VALUE="tutte"><INPUT TYPE="SUBMIT" VALUE="Mostra tutte le stampe"></FORM>}</DIV>
|
||||
{?which_jobs=completed?:<FORM ACTION="{?printer_name=?/jobs:{printer_uri_supported}}" METHOD="GET"><INPUT TYPE="HIDDEN" NAME="which_jobs" VALUE="completed"><INPUT TYPE="SUBMIT" VALUE="Mostra stampe completate"></FORM>}
|
||||
{?which_jobs=all?:<FORM ACTION="{?printer_name=?/jobs:{printer_uri_supported}}" METHOD="GET"><INPUT TYPE="HIDDEN" NAME="which_jobs" VALUE="all"><INPUT TYPE="SUBMIT" VALUE="Mostra tutte le stampe"></FORM>}</DIV>
|
||||
|
||||
<P ALIGN="CENTER">{total=0?Nessuna stampa:Mostrat{total=1?a:e} {#job_id} di {total} stamp{total=1?a:e} {?which_jobs=?attiva:{which_jobs=all?:completata}} }.</P>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
{iscustom=1?<TABLE NAME="paramtable" id="{keyword}-params">{[params]
|
||||
<TR><TH CLASS="sublabel">{paramtext}:</TH>
|
||||
<TD>{params=Units?<SELECT NAME="{keyword}.{params}">
|
||||
<OPTION VALUE="pt"{paramvalue=pt? SELECTED:}>ポイント/OPTION>
|
||||
<OPTION VALUE="pt"{paramvalue=pt? SELECTED:}>ポイント</OPTION>
|
||||
<OPTION VALUE="mm"{paramvalue=mm? SELECTED:}>ミリメートル</OPTION>
|
||||
<OPTION VALUE="cm"{paramvalue=cm? SELECTED:}>センチメートル</OPTION>
|
||||
<OPTION VALUE="in"{paramvalue=in? SELECTED:}>インチ</OPTION>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<INPUT TYPE="HIDDEN" NAME="org.cups.sid" VALUE="{$org.cups.sid}">
|
||||
<INPUT TYPE="HIDDEN" NAME="PRINTER_NAME" VALUE="{printer_name}">
|
||||
<INPUT TYPE="HIDDEN" NAME="OP" VALUE="{op}">
|
||||
{HAVE_AUTOCONFIGURE?<INPUT TYPE="SUBMIT" NAME="AUTOCONFIGURE" VALUE="Zakolejkuj drukarkę do domyślnych opcji">:}
|
||||
{HAVE_AUTOCONFIGURE?<INPUT TYPE="SUBMIT" NAME="AUTOCONFIGURE" VALUE="Pobierz domyślne ustawienia drukarki">:}
|
||||
|
||||
<SCRIPT TYPE="text/javascript"><!--
|
||||
function update_paramtable(option)
|
||||
|
||||
+40
-30
@@ -5,7 +5,7 @@
|
||||
# Perform the complete set of IPP compliance tests specified in the
|
||||
# CUPS Software Test Plan.
|
||||
#
|
||||
# Copyright 2007-2010 by Apple Inc.
|
||||
# Copyright 2007-2011 by Apple Inc.
|
||||
# Copyright 1997-2007 by Easy Software Products, all rights reserved.
|
||||
#
|
||||
# These coded instructions, statements, and computer programs are the
|
||||
@@ -23,11 +23,21 @@ argcount=$#
|
||||
|
||||
make
|
||||
|
||||
#
|
||||
# Solaris has a non-POSIX grep in /bin...
|
||||
#
|
||||
|
||||
if test -x /usr/xpg4/bin/grep; then
|
||||
GREP=/usr/xpg4/bin/grep
|
||||
else
|
||||
GREP=grep
|
||||
fi
|
||||
|
||||
#
|
||||
# Figure out the proper echo options...
|
||||
#
|
||||
|
||||
if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
|
||||
if (echo "testing\c"; echo 1,2,3) | $GREP c >/dev/null; then
|
||||
ac_n=-n
|
||||
ac_c=
|
||||
else
|
||||
@@ -625,7 +635,7 @@ else
|
||||
fi
|
||||
|
||||
# Pages printed on Test1 (within 1 page for timing-dependent cancel issues)
|
||||
count=`grep '^Test1 ' /tmp/cups-$user/log/page_log | awk 'BEGIN{count=0}{count=count+$7}END{print count}'`
|
||||
count=`$GREP '^Test1 ' /tmp/cups-$user/log/page_log | awk 'BEGIN{count=0}{count=count+$7}END{print count}'`
|
||||
expected=`expr $pjobs \* 2 + 34`
|
||||
expected2=`expr $expected + 2`
|
||||
if test $count -lt $expected -a $count -gt $expected2; then
|
||||
@@ -638,7 +648,7 @@ else
|
||||
fi
|
||||
|
||||
# Paged printed on Test2
|
||||
count=`grep '^Test2 ' /tmp/cups-$user/log/page_log | awk 'BEGIN{count=0}{count=count+$7}END{print count}'`
|
||||
count=`$GREP '^Test2 ' /tmp/cups-$user/log/page_log | awk 'BEGIN{count=0}{count=count+$7}END{print count}'`
|
||||
expected=`expr $pjobs \* 2 + 3`
|
||||
if test $count != $expected; then
|
||||
echo "FAIL: Printer 'Test2' produced $count page(s), expected $expected."
|
||||
@@ -651,7 +661,7 @@ fi
|
||||
|
||||
# Requests logged
|
||||
count=`wc -l /tmp/cups-$user/log/access_log | awk '{print $1}'`
|
||||
expected=`expr 39 + 18 + $pjobs \* 8 + $pprinters \* $pjobs \* 4`
|
||||
expected=`expr 37 + 18 + $pjobs \* 8 + $pprinters \* $pjobs \* 4`
|
||||
if test $count != $expected; then
|
||||
echo "FAIL: $count requests logged, expected $expected."
|
||||
echo "<P>FAIL: $count requests logged, expected $expected.</P>" >>$strfile
|
||||
@@ -662,11 +672,11 @@ else
|
||||
fi
|
||||
|
||||
# Did CUPS-Get-Default get logged?
|
||||
if grep -q CUPS-Get-Default /tmp/cups-$user/log/access_log; then
|
||||
if $GREP -q CUPS-Get-Default /tmp/cups-$user/log/access_log; then
|
||||
echo "FAIL: CUPS-Get-Default logged with 'AccessLogLevel actions'"
|
||||
echo "<P>FAIL: CUPS-Get-Default logged with 'AccessLogLevel actions'</P>" >>$strfile
|
||||
echo "<PRE>" >>$strfile
|
||||
grep CUPS-Get-Default /tmp/cups-$user/log/access_log | sed -e '1,$s/&/&/g' -e '1,$s/</</g' >>$strfile
|
||||
$GREP CUPS-Get-Default /tmp/cups-$user/log/access_log | sed -e '1,$s/&/&/g' -e '1,$s/</</g' >>$strfile
|
||||
echo "</PRE>" >>$strfile
|
||||
fail=`expr $fail + 1`
|
||||
else
|
||||
@@ -675,13 +685,13 @@ else
|
||||
fi
|
||||
|
||||
# Emergency log messages
|
||||
count=`grep '^X ' /tmp/cups-$user/log/error_log | wc -l | awk '{print $1}'`
|
||||
count=`$GREP '^X ' /tmp/cups-$user/log/error_log | wc -l | awk '{print $1}'`
|
||||
if test $count != 0; then
|
||||
echo "FAIL: $count emergency messages, expected 0."
|
||||
grep '^X ' /tmp/cups-$user/log/error_log
|
||||
$GREP '^X ' /tmp/cups-$user/log/error_log
|
||||
echo "<P>FAIL: $count emergency messages, expected 0.</P>" >>$strfile
|
||||
echo "<PRE>" >>$strfile
|
||||
grep '^X ' /tmp/cups-$user/log/error_log | sed -e '1,$s/&/&/g' -e '1,$s/</</g' >>$strfile
|
||||
$GREP '^X ' /tmp/cups-$user/log/error_log | sed -e '1,$s/&/&/g' -e '1,$s/</</g' >>$strfile
|
||||
echo "</PRE>" >>$strfile
|
||||
fail=`expr $fail + 1`
|
||||
else
|
||||
@@ -690,13 +700,13 @@ else
|
||||
fi
|
||||
|
||||
# Alert log messages
|
||||
count=`grep '^A ' /tmp/cups-$user/log/error_log | wc -l | awk '{print $1}'`
|
||||
count=`$GREP '^A ' /tmp/cups-$user/log/error_log | wc -l | awk '{print $1}'`
|
||||
if test $count != 0; then
|
||||
echo "FAIL: $count alert messages, expected 0."
|
||||
grep '^A ' /tmp/cups-$user/log/error_log
|
||||
$GREP '^A ' /tmp/cups-$user/log/error_log
|
||||
echo "<P>FAIL: $count alert messages, expected 0.</P>" >>$strfile
|
||||
echo "<PRE>" >>$strfile
|
||||
grep '^A ' /tmp/cups-$user/log/error_log | sed -e '1,$s/&/&/g' -e '1,$s/</</g' >>$strfile
|
||||
$GREP '^A ' /tmp/cups-$user/log/error_log | sed -e '1,$s/&/&/g' -e '1,$s/</</g' >>$strfile
|
||||
echo "</PRE>" >>$strfile
|
||||
fail=`expr $fail + 1`
|
||||
else
|
||||
@@ -705,13 +715,13 @@ else
|
||||
fi
|
||||
|
||||
# Critical log messages
|
||||
count=`grep '^C ' /tmp/cups-$user/log/error_log | wc -l | awk '{print $1}'`
|
||||
count=`$GREP '^C ' /tmp/cups-$user/log/error_log | wc -l | awk '{print $1}'`
|
||||
if test $count != 0; then
|
||||
echo "FAIL: $count critical messages, expected 0."
|
||||
grep '^C ' /tmp/cups-$user/log/error_log
|
||||
$GREP '^C ' /tmp/cups-$user/log/error_log
|
||||
echo "<P>FAIL: $count critical messages, expected 0.</P>" >>$strfile
|
||||
echo "<PRE>" >>$strfile
|
||||
grep '^C ' /tmp/cups-$user/log/error_log | sed -e '1,$s/&/&/g' -e '1,$s/</</g' >>$strfile
|
||||
$GREP '^C ' /tmp/cups-$user/log/error_log | sed -e '1,$s/&/&/g' -e '1,$s/</</g' >>$strfile
|
||||
echo "</PRE>" >>$strfile
|
||||
fail=`expr $fail + 1`
|
||||
else
|
||||
@@ -720,13 +730,13 @@ else
|
||||
fi
|
||||
|
||||
# Error log messages
|
||||
count=`grep '^E ' /tmp/cups-$user/log/error_log | wc -l | awk '{print $1}'`
|
||||
count=`$GREP '^E ' /tmp/cups-$user/log/error_log | wc -l | awk '{print $1}'`
|
||||
if test $count != 18; then
|
||||
echo "FAIL: $count error messages, expected 18."
|
||||
grep '^E ' /tmp/cups-$user/log/error_log
|
||||
$GREP '^E ' /tmp/cups-$user/log/error_log
|
||||
echo "<P>FAIL: $count error messages, expected 18.</P>" >>$strfile
|
||||
echo "<PRE>" >>$strfile
|
||||
grep '^E ' /tmp/cups-$user/log/error_log | sed -e '1,$s/&/&/g' -e '1,$s/</</g' >>$strfile
|
||||
$GREP '^E ' /tmp/cups-$user/log/error_log | sed -e '1,$s/&/&/g' -e '1,$s/</</g' >>$strfile
|
||||
echo "</PRE>" >>$strfile
|
||||
fail=`expr $fail + 1`
|
||||
else
|
||||
@@ -735,13 +745,13 @@ else
|
||||
fi
|
||||
|
||||
# Warning log messages
|
||||
count=`grep '^W ' /tmp/cups-$user/log/error_log | wc -l | awk '{print $1}'`
|
||||
count=`$GREP '^W ' /tmp/cups-$user/log/error_log | wc -l | awk '{print $1}'`
|
||||
if test $count != 0; then
|
||||
echo "FAIL: $count warning messages, expected 0."
|
||||
grep '^W ' /tmp/cups-$user/log/error_log
|
||||
$GREP '^W ' /tmp/cups-$user/log/error_log
|
||||
echo "<P>FAIL: $count warning messages, expected 0.</P>" >>$strfile
|
||||
echo "<PRE>" >>$strfile
|
||||
grep '^W ' /tmp/cups-$user/log/error_log | sed -e '1,$s/&/&/g' -e '1,$s/</</g' >>$strfile
|
||||
$GREP '^W ' /tmp/cups-$user/log/error_log | sed -e '1,$s/&/&/g' -e '1,$s/</</g' >>$strfile
|
||||
echo "</PRE>" >>$strfile
|
||||
fail=`expr $fail + 1`
|
||||
else
|
||||
@@ -750,13 +760,13 @@ else
|
||||
fi
|
||||
|
||||
# Notice log messages
|
||||
count=`grep '^N ' /tmp/cups-$user/log/error_log | wc -l | awk '{print $1}'`
|
||||
count=`$GREP '^N ' /tmp/cups-$user/log/error_log | wc -l | awk '{print $1}'`
|
||||
if test $count != 0; then
|
||||
echo "FAIL: $count notice messages, expected 0."
|
||||
grep '^N ' /tmp/cups-$user/log/error_log
|
||||
$GREP '^N ' /tmp/cups-$user/log/error_log
|
||||
echo "<P>FAIL: $count notice messages, expected 0.</P>" >>$strfile
|
||||
echo "<PRE>" >>$strfile
|
||||
grep '^N ' /tmp/cups-$user/log/error_log | sed -e '1,$s/&/&/g' -e '1,$s/</</g' >>$strfile
|
||||
$GREP '^N ' /tmp/cups-$user/log/error_log | sed -e '1,$s/&/&/g' -e '1,$s/</</g' >>$strfile
|
||||
echo "</PRE>" >>$strfile
|
||||
fail=`expr $fail + 1`
|
||||
else
|
||||
@@ -765,7 +775,7 @@ else
|
||||
fi
|
||||
|
||||
# Info log messages
|
||||
count=`grep '^I ' /tmp/cups-$user/log/error_log | wc -l | awk '{print $1}'`
|
||||
count=`$GREP '^I ' /tmp/cups-$user/log/error_log | wc -l | awk '{print $1}'`
|
||||
if test $count = 0; then
|
||||
echo "FAIL: $count info messages, expected more than 0."
|
||||
echo "<P>FAIL: $count info messages, expected more than 0.</P>" >>$strfile
|
||||
@@ -776,7 +786,7 @@ else
|
||||
fi
|
||||
|
||||
# Debug log messages
|
||||
count=`grep '^D ' /tmp/cups-$user/log/error_log | wc -l | awk '{print $1}'`
|
||||
count=`$GREP '^D ' /tmp/cups-$user/log/error_log | wc -l | awk '{print $1}'`
|
||||
if test $count = 0; then
|
||||
echo "FAIL: $count debug messages, expected more than 0."
|
||||
echo "<P>FAIL: $count debug messages, expected more than 0.</P>" >>$strfile
|
||||
@@ -787,7 +797,7 @@ else
|
||||
fi
|
||||
|
||||
# Debug2 log messages
|
||||
count=`grep '^d ' /tmp/cups-$user/log/error_log | wc -l | awk '{print $1}'`
|
||||
count=`$GREP '^d ' /tmp/cups-$user/log/error_log | wc -l | awk '{print $1}'`
|
||||
if test $count = 0; then
|
||||
echo "FAIL: $count debug2 messages, expected more than 0."
|
||||
echo "<P>FAIL: $count debug2 messages, expected more than 0.</P>" >>$strfile
|
||||
@@ -798,7 +808,7 @@ else
|
||||
fi
|
||||
|
||||
# Page log file...
|
||||
if grep -iq 'testfile.pdf na_letter_8.5x11in' /tmp/cups-$user/log/page_log; then
|
||||
if $GREP -iq 'testfile.pdf na_letter_8.5x11in' /tmp/cups-$user/log/page_log; then
|
||||
echo "PASS: page_log formatted correctly."
|
||||
echo "<P>PASS: page_log formatted correctly.</P>" >>$strfile
|
||||
else
|
||||
@@ -815,7 +825,7 @@ echo "</PRE>" >>$strfile
|
||||
|
||||
echo "<H2>error_log</H2>" >>$strfile
|
||||
echo "<PRE>" >>$strfile
|
||||
grep -v '^d' /tmp/cups-$user/log/error_log | sed -e '1,$s/&/&/g' -e '1,$s/</</g' >>$strfile
|
||||
$GREP -v '^d' /tmp/cups-$user/log/error_log | sed -e '1,$s/&/&/g' -e '1,$s/</</g' >>$strfile
|
||||
echo "</PRE>" >>$strfile
|
||||
|
||||
echo "<H2>page_log</H2>" >>$strfile
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdarg.h>
|
||||
#include <ctype.h>
|
||||
#include <io.h>
|
||||
|
||||
|
||||
|
||||
Referência em uma Nova Issue
Bloquear um usuário