This commit is contained in:
parent
be07d115f5
commit
daa765de20
166
cups-1.3.9-max_subscription.patch
Normal file
166
cups-1.3.9-max_subscription.patch
Normal file
@ -0,0 +1,166 @@
|
||||
--- cups-1.3.9/test/run-stp-tests.sh.orig 2008-11-20 15:02:22.000000000 +0100
|
||||
+++ cups-1.3.9/test/run-stp-tests.sh 2008-11-20 15:02:49.000000000 +0100
|
||||
@@ -307,6 +307,7 @@ FontPath /tmp/cups-$user/share/fonts
|
||||
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
|
||||
--- cups-1.3.9/test/4.4-subscription-ops.test.orig 2007-07-09 22:34:48.000000000 +0200
|
||||
+++ cups-1.3.9/test/4.4-subscription-ops.test 2008-11-20 15:02:49.000000000 +0100
|
||||
@@ -116,6 +116,32 @@
|
||||
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 $method://$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 $"
|
||||
--- cups-1.3.9/scheduler/subscriptions.c.orig 2008-01-23 23:23:42.000000000 +0100
|
||||
+++ cups-1.3.9/scheduler/subscriptions.c 2008-11-20 15:02:49.000000000 +0100
|
||||
@@ -341,8 +341,54 @@ cupsdAddSubscription(
|
||||
* Limit the number of subscriptions...
|
||||
*/
|
||||
|
||||
- if (cupsArrayCount(Subscriptions) >= MaxSubscriptions)
|
||||
+ if (MaxSubscriptions > 0 && cupsArrayCount(Subscriptions) >= MaxSubscriptions)
|
||||
+ {
|
||||
+ cupsdLogMessage(CUPSD_LOG_DEBUG,
|
||||
+ "cupsdAddSubscription: Reached MaxSubscriptions %d",
|
||||
+ MaxSubscriptions);
|
||||
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", MaxSubscriptionsPerJob, job->id);
|
||||
+ 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",
|
||||
+ MaxSubscriptionsPerPrinter, dest->name);
|
||||
+ return (NULL);
|
||||
+ }
|
||||
+ }
|
||||
|
||||
/*
|
||||
* Allocate memory for this subscription...
|
||||
@@ -758,7 +804,6 @@ cupsdLoadAllSubscriptions(void)
|
||||
cupsdLogMessage(CUPSD_LOG_ERROR,
|
||||
"Syntax error on line %d of subscriptions.conf.",
|
||||
linenum);
|
||||
- break;
|
||||
}
|
||||
else if (!strcasecmp(line, "Events"))
|
||||
{
|
||||
--- cups-1.3.9/scheduler/ipp.c.orig 2008-09-17 00:39:44.000000000 +0200
|
||||
+++ cups-1.3.9/scheduler/ipp.c 2008-11-20 15:02:49.000000000 +0100
|
||||
@@ -2119,24 +2119,25 @@ add_job_subscriptions(
|
||||
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;
|
||||
}
|
||||
@@ -5590,7 +5591,12 @@ create_subscription(
|
||||
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",
|
@ -1,3 +1,8 @@
|
||||
-------------------------------------------------------------------
|
||||
Thu Nov 20 15:05:36 CET 2008 - kssingvo@suse.de
|
||||
|
||||
- fixed rss subscription issue (bnc#446975)
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Tue Nov 4 13:54:37 CET 2008 - kssingvo@suse.de
|
||||
|
||||
|
@ -30,7 +30,7 @@ License: GPL v2 or later
|
||||
Group: Hardware/Printing
|
||||
Summary: The Common UNIX Printing System
|
||||
Version: 1.3.9
|
||||
Release: 4
|
||||
Release: 5
|
||||
Requires: cups-libs = %{version}, cups-client = %{version}
|
||||
Requires: ghostscript_any, ghostscript-fonts-std, foomatic-filters
|
||||
Requires: util-linux /usr/bin/pdftops
|
||||
@ -82,6 +82,7 @@ Patch20: cups-1.3.7-keeping_recommended.patch
|
||||
Patch21: cups-1.3.7-lppasswd_fixperm.patch
|
||||
Patch22: cups-1.3.7-additional_policies.patch
|
||||
Patch23: cups-1.3.9-cupstestppd.patch
|
||||
Patch24: cups-1.3.9-max_subscription.patch
|
||||
Patch100: cups-1.1.23-testpage.patch
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||
|
||||
@ -192,6 +193,7 @@ mv pdftops pdftos.use_filter_pdftops_c
|
||||
%patch21 -p1
|
||||
%patch22 -p1
|
||||
%patch23 -p1
|
||||
%patch24 -p1
|
||||
if [ -f /.buildenv ]; then
|
||||
. /.buildenv
|
||||
test -z "$BUILD_DISTRIBUTION_NAME" && BUILD_DISTRIBUTION_NAME="%{?distribution}"
|
||||
@ -445,6 +447,8 @@ rm -rf $RPM_BUILD_ROOT/usr/share/locale/no
|
||||
%{_datadir}/locale/*/cups_*
|
||||
|
||||
%changelog
|
||||
* Thu Nov 20 2008 kssingvo@suse.de
|
||||
- fixed rss subscription issue (bnc#446975)
|
||||
* Tue Nov 04 2008 kssingvo@suse.de
|
||||
- missed to fix a further PPD file: stcolor2.ppd
|
||||
* Thu Oct 30 2008 kssingvo@suse.de
|
||||
|
Loading…
x
Reference in New Issue
Block a user