CHANGES IN CUPS V1.3.10
- - Documentation fixes (STR #2994, STR #2995)
+ - Documentation fixes (STR #2994, STR #2995, STR #3008)
+ - The scheduler would crash if you exceeded the MaxSubscriptions
+ limit.
+ - The lp "-H immediate" option did not specify that the job
+ should not be held (STR #3013)
+ - The scheduler did not support the "Connection: close"
+ HTTP header (STR #3010)
+ - The mailto notifier didn't terminate messages properly
+ (STR #3011)
- Backends could spin trying to read back-channel data
(STR #3001)
- The HP-GL/2 filter was using the wrong default colors
-CHANGES.txt - 2008-11-14
+CHANGES.txt - 2008-11-19
------------------------
CHANGES IN CUPS V1.4b2
- Documentation updates (STR #2983, STR #2998)
+ - The LPD backend no longer tries to collect page accounting
+ information since the LPD protocol does not allow us to
+ prevent race conditions.
+ - The scheduler did not save the last marker-change-time value.
+ - Fixed a problem with printing to some IPP printers, including
+ CUPS 1.1.x.
+ - Fixed a redirection problem with the printer web page (STR #3012)
- Fixed a PPD compiler problem with the loading of message
catalogs (STR #2990)
- Fixed a PPD compiler problem with the loading of .strings files
char addrname[256]; /* Address name */
http_addrlist_t *addrlist, /* Address list */
*addr; /* Socket address */
- int snmp_fd, /* SNMP socket */
- start_count, /* Page count via SNMP at start */
- page_count; /* Page count via SNMP */
+ int snmp_fd; /* SNMP socket */
int copy; /* Copies written */
time_t start_time; /* Time of first connect */
int recoverable; /* Recoverable error shown? */
if ((snmp_fd = _cupsSNMPOpen(addr->addr.addr.sa_family)) >= 0)
{
- if (backendSNMPSupplies(snmp_fd, &(addr->addr), &start_count, NULL))
+ if (backendSNMPSupplies(snmp_fd, &(addr->addr), NULL, NULL))
{
/*
* No, close it...
}
/*
- * Collect the final page count as needed...
+ * Collect the final supply levels as needed...
*/
if (snmp_fd >= 0)
- {
- int printer_state; /* State of printer */
-
-
- while (!backendSNMPSupplies(snmp_fd, &(addr->addr), &page_count,
- &printer_state) &&
- printer_state != CUPS_TC_idle)
- sleep(3);
-
- if (page_count > start_count)
- fprintf(stderr, "PAGE: total %d\n", page_count - start_count);
- }
+ backendSNMPSupplies(snmp_fd, &(addr->addr), NULL, NULL);
/*
* Close the socket connection and input file...
*
* Class status CGI for the Common UNIX Printing System (CUPS).
*
- * Copyright 2007 by Apple Inc.
+ * Copyright 2007-2008 by Apple Inc.
* Copyright 1997-2006 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
*
* Contents:
*
+ * main() - Main entry for CGI.
+ * do_class_op() - Do a class operation.
+ * show_all_classes() - Show all classes...
+ * show_class() - Show a single class.
*/
/*
*
* Contents:
*
+ * main() - Main entry for CGI.
+ * do_printer_op() - Do a printer operation.
+ * show_all_printers() - Show all printers...
+ * show_printer() - Show a single printer.
*/
/*
cgiRewriteURL(uri, url, sizeof(url), NULL);
cgiFormEncode(uri, url, sizeof(uri));
- snprintf(refresh, sizeof(refresh), "5;URL=q%s", uri);
+ snprintf(refresh, sizeof(refresh), "5;URL=%s", uri);
cgiSetVariable("refresh_page", refresh);
cgiStartHTML(title);
fi
dnl Debug printfs can slow things down, so provide a separate option for that
-if test x$enable_debug_printf = xyes; then
+if test x$enable_debug_printfs = xyes; then
CFLAGS="$CFLAGS -DDEBUG"
fi
AC_SUBST(PAP)
if test x$enable_pap != xno -a $uname = Darwin; then
- PAP="pap"
- AC_CHECK_HEADER(AppleTalk/at_proto.h)
+ AC_CHECK_HEADER(netat/appletalk.h,[
+ PAP="pap"
+ AC_CHECK_HEADER(AppleTalk/at_proto.h)])
fi
dnl
else
length = ippLength(request);
+ DEBUG_printf(("cupsDoIORequest: Request length=%ld, total length=%ld",
+ (long)ippLength(request), (long)length));
+
/*
* Loop until we can send the request without authorization problems.
*/
if (httpWait(http, 1000))
status = httpUpdate(http);
- else
- status = HTTP_EXPECTATION_FAILED;
}
else if (httpCheck(http))
status = httpUpdate(http);
*/
expect = (http_status_t)0;
+
+ if (httpReconnect(http))
+ {
+ _cupsSetError(IPP_SERVICE_UNAVAILABLE, NULL, 0);
+ return (HTTP_SERVICE_UNAVAILABLE);
+ }
break;
default :
<P>The default is to print all pages.
+<blockquote><b>Note:</b>
+
+<p>The page numbers used by <code>page-ranges</code> refer to the output
+pages and not the document's page numbers. Options like <code>number-up</code>
+can make the output page numbering not match the document page numbers.</p>
+
+</blockquote>
+
+
<H3><A NAME="PAGESET">Selecting Even or Odd Pages</A></H3>
<P>Use the <CODE>-o page-set=set</CODE> option to select the even or odd pages:</P>
.\" 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 "Common UNIX Printing System" "29 August 2008" "Apple Inc."
+.TH lp 1 "Common UNIX Printing System" "17 November 2008" "Apple Inc."
.SH NAME
lp - print files
.SH SYNOPSIS
.br
Specifies which pages to print in the document. The list can
contain a list of numbers and ranges (#-#) separated by commas
-(e.g. 1,3-5,16).
+(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
.br
Scales the print file to fit on the page.
.TP 5
+-o number-up=2
+.TP 5
+-o number-up=4
+.TP 5
+-o number-up=6
+.TP 5
+-o number-up=9
+.TP 5
+-o number-up=16
+.br
+Prints multiple document pages on each output page.
+.TP 5
-o scaling=number
.br
Scales image files to use up to \fInumber\fR percent of the page.
cupsdAuthorize(con);
- if (!strncmp(con->http.fields[HTTP_FIELD_CONNECTION], "Keep-Alive", 10) &&
+ if (!strncasecmp(con->http.fields[HTTP_FIELD_CONNECTION], "Keep-Alive", 10) &&
KeepAlive)
con->http.keep_alive = HTTP_KEEPALIVE_ON;
+ else if (!strncasecmp(con->http.fields[HTTP_FIELD_CONNECTION], "close", 5))
+ con->http.keep_alive = HTTP_KEEPALIVE_OFF;
if (!con->http.fields[HTTP_FIELD_HOST][0] &&
con->http.version >= HTTP_1_1)
if (mask == CUPSD_EVENT_NONE)
mask = CUPSD_EVENT_JOB_COMPLETED;
- sub = cupsdAddSubscription(mask, cupsdFindDest(job->dest), job, recipient,
- 0);
+ if ((sub = cupsdAddSubscription(mask, cupsdFindDest(job->dest), job,
+ recipient, 0)) != NULL)
+ {
+ sub->interval = interval;
- sub->interval = interval;
+ cupsdSetString(&sub->owner, job->username);
- cupsdSetString(&sub->owner, job->username);
+ if (user_data)
+ {
+ sub->user_data_len = user_data->values[0].unknown.length;
+ memcpy(sub->user_data, user_data->values[0].unknown.data,
+ sub->user_data_len);
+ }
- if (user_data)
- {
- sub->user_data_len = user_data->values[0].unknown.length;
- memcpy(sub->user_data, user_data->values[0].unknown.data,
- sub->user_data_len);
+ ippAddSeparator(con->response);
+ ippAddInteger(con->response, IPP_TAG_SUBSCRIPTION, IPP_TAG_INTEGER,
+ "notify-subscription-id", sub->id);
}
- ippAddSeparator(con->response);
- ippAddInteger(con->response, IPP_TAG_SUBSCRIPTION, IPP_TAG_INTEGER,
- "notify-subscription-id", sub->id);
-
if (attr)
attr = attr->next;
}
else
job = NULL;
- sub = cupsdAddSubscription(mask, printer, job, recipient, 0);
+ if ((sub = cupsdAddSubscription(mask, printer, job, recipient, 0)) == NULL)
+ {
+ send_ipp_status(con, IPP_TOO_MANY_SUBSCRIPTIONS,
+ _("There are too many subscriptions."));
+ return;
+ }
if (job)
cupsdLogMessage(CUPSD_LOG_DEBUG, "Added subscription %d for job %d",
cupsdSetPrinterAttr(job->printer, "marker-colors", (char *)attr);
job->printer->marker_time = time(NULL);
event |= CUPSD_EVENT_PRINTER_STATE;
+ cupsdMarkDirty(CUPSD_DIRTY_PRINTERS);
}
if ((attr = cupsGetOption("marker-levels", num_attrs, attrs)) != NULL)
cupsdSetPrinterAttr(job->printer, "marker-levels", (char *)attr);
job->printer->marker_time = time(NULL);
event |= CUPSD_EVENT_PRINTER_STATE;
+ cupsdMarkDirty(CUPSD_DIRTY_PRINTERS);
}
if ((attr = cupsGetOption("marker-message", num_attrs, attrs)) != NULL)
cupsdSetPrinterAttr(job->printer, "marker-message", (char *)attr);
job->printer->marker_time = time(NULL);
event |= CUPSD_EVENT_PRINTER_STATE;
+ cupsdMarkDirty(CUPSD_DIRTY_PRINTERS);
}
if ((attr = cupsGetOption("marker-names", num_attrs, attrs)) != NULL)
cupsdSetPrinterAttr(job->printer, "marker-names", (char *)attr);
job->printer->marker_time = time(NULL);
event |= CUPSD_EVENT_PRINTER_STATE;
+ cupsdMarkDirty(CUPSD_DIRTY_PRINTERS);
}
if ((attr = cupsGetOption("marker-types", num_attrs, attrs)) != NULL)
cupsdSetPrinterAttr(job->printer, "marker-types", (char *)attr);
job->printer->marker_time = time(NULL);
event |= CUPSD_EVENT_PRINTER_STATE;
+ cupsdMarkDirty(CUPSD_DIRTY_PRINTERS);
}
cupsFreeOptions(num_attrs, attrs);
if (!p->attrs)
cupsdSetPrinterAttrs(p);
- cupsdSetPrinterAttr(p, value, valueptr);
-
- if (!strncmp(value, "marker-", 7))
- p->marker_time = time(NULL);
+ if (!strcmp(value, "marker-change-time"))
+ p->marker_time = atoi(valueptr);
+ else
+ cupsdSetPrinterAttr(p, value, valueptr);
}
}
else
cupsFilePutConf(fp, "Attribute", value);
}
+ if (printer->marker_time)
+ cupsFilePrintf(fp, "Attribute marker-change-time %ld\n",
+ (long)printer->marker_time);
+
cupsFilePuts(fp, "</Printer>\n");
#ifdef __sgi
value = ptr;
}
}
-
- cupsdMarkDirty(CUPSD_DIRTY_PRINTERS);
}
* Limit the number of subscriptions...
*/
- if (cupsArrayCount(Subscriptions) >= MaxSubscriptions)
+ if (MaxSubscriptions > 0 && cupsArrayCount(Subscriptions) >= MaxSubscriptions)
+ {
+ cupsdLogMessage(CUPSD_LOG_DEBUG,
+ "cupsdAddSubscription: Reached MaxSubscriptions %d "
+ "(count=%d)", MaxSubscriptions,
+ cupsArrayCount(Subscriptions));
return (NULL);
+ }
+
+ if (MaxSubscriptionsPerJob > 0 && job)
+ {
+ int count; /* Number of job subscriptions */
+
+ for (temp = (cupsd_subscription_t *)cupsArrayFirst(Subscriptions),
+ count = 0;
+ temp;
+ temp = (cupsd_subscription_t *)cupsArrayNext(Subscriptions))
+ if (temp->job == job)
+ count ++;
+
+ if (count >= MaxSubscriptionsPerJob)
+ {
+ cupsdLogMessage(CUPSD_LOG_DEBUG,
+ "cupsdAddSubscription: Reached MaxSubscriptionsPerJob %d "
+ "for job #%d (count=%d)", MaxSubscriptionsPerJob,
+ job->id, count);
+ return (NULL);
+ }
+ }
+
+ if (MaxSubscriptionsPerPrinter > 0 && dest)
+ {
+ int count; /* Number of printer subscriptions */
+
+ for (temp = (cupsd_subscription_t *)cupsArrayFirst(Subscriptions),
+ count = 0;
+ temp;
+ temp = (cupsd_subscription_t *)cupsArrayNext(Subscriptions))
+ if (temp->dest == dest)
+ count ++;
+
+ if (count >= MaxSubscriptionsPerPrinter)
+ {
+ cupsdLogMessage(CUPSD_LOG_DEBUG,
+ "cupsdAddSubscription: Reached "
+ "MaxSubscriptionsPerPrinter %d for %s (count=%d)",
+ MaxSubscriptionsPerPrinter, dest->name, count);
+ return (NULL);
+ }
+ }
/*
* Allocate memory for this subscription...
cupsdLogMessage(CUPSD_LOG_ERROR,
"Syntax error on line %d of subscriptions.conf.",
linenum);
- break;
}
else if (!strcasecmp(line, "Events"))
{
*
* "lp" command for the Common UNIX Printing System (CUPS).
*
- * Copyright 2007 by Apple Inc.
+ * Copyright 2007-2008 by Apple Inc.
* Copyright 1997-2007 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
num_options = cupsAddOption("job-hold-until", "no-hold",
num_options, &options);
else if (!strcmp(val, "immediate"))
+ {
+ num_options = cupsAddOption("job-hold-until", "no-hold",
+ num_options, &options);
num_options = cupsAddOption("job-priority", "100",
num_options, &options);
+ }
else if (!strcmp(val, "restart"))
{
if (job_id < 1)
*
* attributes-charset
* attributes-natural-language
- * job-uri
+ * printer-uri
* requested-attributes
+ * requesting-user-name
+ * which-jobs
*/
request = ippNewRequest(IPP_GET_JOBS);
+ ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri",
+ NULL, "ipp://localhost/");
+
ippAddStrings(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD,
"requested-attributes", sizeof(jattrs) / sizeof(jattrs[0]),
NULL, jattrs);
- ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "job-uri",
- NULL, "ipp://localhost/jobs/");
+ ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name",
+ NULL, cupsUser());
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD, "which-jobs",
NULL, which);
#
-# "$Id: 4.1-requests.test 1595 2001-03-01 20:40:17Z mike $"
+# "$Id: 4.1-requests.test 8144 2008-11-19 19:23:12Z mike $"
#
# Verify that the server requires the following attributes:
#
GROUP operation
ATTR charset attributes-charset utf-8
ATTR language attributes-natural-language en
- ATTR uri job-uri $method://$hostname:$port/jobs
+ ATTR uri job-uri $scheme://$hostname:$port/jobs
# What statuses are OK?
- STATUS successful-ok
+ STATUS client-error-bad-request
# What attributes do we expect?
EXPECT attributes-charset
EXPECT attributes-natural-language
}
#
-# End of "$Id: 4.1-requests.test 1595 2001-03-01 20:40:17Z mike $"
+# End of "$Id: 4.1-requests.test 8144 2008-11-19 19:23:12Z mike $"
#
GROUP operation
ATTR charset attributes-charset utf-8
ATTR language attributes-natural-language en
- ATTR uri job-uri $method://$hostname:$port/jobs
+ ATTR uri printer-uri $scheme://$hostname:$port/
# What statuses are OK?
STATUS successful-ok
GROUP operation
ATTR charset attributes-charset utf-8
ATTR language attributes-natural-language en
- ATTR uri printer-uri $method://$hostname:$port/printers/Test1
+ ATTR uri printer-uri $scheme://$hostname:$port/printers/Test1
GROUP subscription
ATTR uri notify-recipient-uri testnotify://
GROUP operation
ATTR charset attributes-charset utf-8
ATTR language attributes-natural-language en
- ATTR uri printer-uri $method://$hostname:$port/printers/Test1
+ ATTR uri printer-uri $scheme://$hostname:$port/printers/Test1
ATTR integer notify-subscription-id $notify-subscription-id
# What statuses are OK?
GROUP operation
ATTR charset attributes-charset utf-8
ATTR language attributes-natural-language en
- ATTR uri printer-uri $method://$hostname:$port/printers/Test1
+ ATTR uri printer-uri $scheme://$hostname:$port/printers/Test1
GROUP subscription
ATTR uri notify-recipient-uri testnotify://
GROUP operation
ATTR charset attributes-charset utf-8
ATTR language attributes-natural-language en
- ATTR uri printer-uri $method://$hostname:$port/printers/Test1
+ ATTR uri printer-uri $scheme://$hostname:$port/printers/Test1
# What statuses are OK?
STATUS successful-ok
EXPECT notify-events
DISPLAY notify-events
}
+{
+ # The name of the test...
+ NAME "Check MaxSubscriptions limits"
+
+ # The operation to use
+ OPERATION Create-Printer-Subscription
+ RESOURCE /
+
+ # The attributes to send
+ GROUP operation
+ ATTR charset attributes-charset utf-8
+ ATTR language attributes-natural-language en
+ ATTR uri printer-uri $scheme://$hostname:$port/printers/Test1
+
+ GROUP subscription
+ ATTR uri notify-recipient-uri testnotify://
+ ATTR keyword notify-events printer-state-changed
+ ATTR integer notify-lease-duration 5
+
+ # What statuses are OK?
+ STATUS client-error-too-many-subscriptions
+
+ # What attributes do we expect?
+ EXPECT attributes-charset
+ EXPECT attributes-natural-language
+}
#
# End of "$Id: 4.4-subscription-ops.test 6635 2007-07-09 20:34:48Z mike $"
echo "LPQ Test"
echo ""
-echo " lpq"
-../berkeley/lpq 2>&1
+echo " lpq -P Test1"
+../berkeley/lpq -P Test1 2>&1
if test $? != 0; then
echo " FAILED"
exit 1
*
* main() - Parse options and do tests.
* do_tests() - Do tests as specified in the test file.
- * ippTagValue() - Get an IPP value or group tag from a name...
* get_token() - Get a token from a file.
* print_attr() - Print an attribute on the screen.
* usage() - Show program usage.
int linenum; /* Current line number */
int version; /* IPP version number to use */
http_t *http; /* HTTP connection to server */
- char method[HTTP_MAX_URI], /* URI method */
+ char scheme[HTTP_MAX_URI], /* URI scheme */
userpass[HTTP_MAX_URI], /* username:password */
server[HTTP_MAX_URI], /* Server */
resource[HTTP_MAX_URI]; /* Resource path */
* Connect to the server...
*/
- httpSeparateURI(HTTP_URI_CODING_ALL, uri, method, sizeof(method), userpass,
+ httpSeparateURI(HTTP_URI_CODING_ALL, uri, scheme, sizeof(scheme), userpass,
sizeof(userpass), server, sizeof(server), &port, resource,
sizeof(resource));
if ((http = httpConnect(server, port)) == NULL)
* Initialize things...
*/
- httpSeparateURI(HTTP_URI_CODING_ALL, uri, method, sizeof(method), userpass,
+ httpSeparateURI(HTTP_URI_CODING_ALL, uri, scheme, sizeof(scheme), userpass,
sizeof(userpass), server, sizeof(server), &port, resource,
sizeof(resource));
strlcpy(tokenptr, uri, sizeof(token) - (tokenptr - token));
tempptr += 4;
}
- else if (!strncasecmp(tempptr + 1, "method", 6))
+ else if (!strncasecmp(tempptr + 1, "scheme", 6) ||
+ !strncasecmp(tempptr + 1, "method", 6))
{
- strlcpy(tokenptr, method, sizeof(token) - (tokenptr - token));
+ strlcpy(tokenptr, scheme, sizeof(token) - (tokenptr - token));
tempptr += 7;
}
else if (!strncasecmp(tempptr + 1, "username", 8))
GROUP job
ATTR integer copies 1
- FILE ../data/testprint.ps
+ FILE testfile.ps
# What statuses are OK?
- STATUS ok
- STATUS ok-subst
+ STATUS successful-ok
+ STATUS successful-ok-ignored-or-substituted-attributes
# What attributes do we expect?
EXPECT job-id
DocumentRoot $root/doc
RequestRoot /tmp/cups-$user/spool
TempDir /tmp/cups-$user/spool/temp
+MaxSubscriptions 3
MaxLogSize 0
AccessLog /tmp/cups-$user/log/access_log
ErrorLog /tmp/cups-$user/log/error_log
# Error log messages
count=`grep '^E ' /tmp/cups-$user/log/error_log | wc -l | awk '{print $1}'`
-if test $count != 15; then
- echo "FAIL: $count error messages, expected 15."
+if test $count != 17; then
+ echo "FAIL: $count error messages, expected 17."
grep '^E ' /tmp/cups-$user/log/error_log
- echo "<P>FAIL: $count error messages, expected 9.</P>" >>$strfile
+ echo "<P>FAIL: $count error messages, expected 17.</P>" >>$strfile
echo "<PRE>" >>$strfile
grep '^E ' /tmp/cups-$user/log/error_log | sed -e '1,$s/&/&/g' -e '1,$s/</</g' >>$strfile
echo "</PRE>" >>$strfile