The schedulers Restart-Job operation needs to honor "job-hold-until" #3130

Closed
michaelrsweet opened this Issue Mar 14, 2009 · 3 comments

Comments

Projects
None yet
1 participant
Collaborator

michaelrsweet commented Mar 14, 2009

Version: 1.3-current
CUPS.org User: opher

Hello,
In rfc2911 http://www.ietf.org/rfc/rfc2911.txt
section 3.3.7.1 states:

3.3.7.1 Restart-Job Request

The groups and attributes are the same as for a Cancel-Job request
(see section 3.3.3.1), with the addition of the following Group 1
Operation attribute:

  "job-hold-until" (type3 keyword | name(MAX)):
     The client OPTIONALLY supplies this attribute.  The IPP object
     MUST support this Operation attribute in a Restart-Job request,
     if it supports the "job-hold-until" Job Template attribute in
     create operations.  See section 4.2.2.  Otherwise, the IPP
     object NEED NOT support the "job-hold-until" Operation
     attribute in a Restart-Job request.

     If supplied and supported as specified in the Printer's "job-
     hold-until-supported" attribute, the IPP object copies the
     supplied Operation attribute to the Job object, replacing the
     job's previous "job-hold-until" attribute, if present, and
     makes the job a candidate for scheduling during the supplied
     named time period.  See section 4.2.2.

[etc...]

But the schedulers Restart-Job IPP operation does not consider "job-hold-until" in its implementation.

Regards,
Opher Shachar.

Collaborator

michaelrsweet commented Mar 18, 2009

CUPS.org User: mike

Fixed in Subversion repository.

Collaborator

michaelrsweet commented Mar 18, 2009

"str3130-1.3.patch":

Index: scheduler/ipp.c

--- scheduler/ipp.c (revision 8449)
+++ scheduler/ipp.c (working copy)
@@ -8245,12 +8245,12 @@
{
ipp_attribute_t attr; / Current attribute /
int jobid; /
Job ID */

  • cupsd_job_t job; / Job information /
    char method[HTTP_MAX_URI], /
    Method portion of URI /
    username[HTTP_MAX_URI], /
    Username portion of URI /
    host[HTTP_MAX_URI], /
    Host portion of URI /
    resource[HTTP_MAX_URI]; /
    Resource portion of URI /
    int port; /
    Port portion of URI */
  • cupsd_job_t job; / Job information */

cupsdLogMessage(CUPSD_LOG_DEBUG2, "restart_job(%p[%d], %s)", con,
@@ -8358,11 +8358,37 @@
}

/*

  • * Restart the job and return...
    • See if the job-hold-until attribute is specified...
      */
  • cupsdRestartJob(job);
  • if ((attr = ippFindAttribute(con->request, "job-hold-until",
  •                           IPP_TAG_KEYWORD)) == NULL)
    
  • attr = ippFindAttribute(con->request, "job-hold-until", IPP_TAG_NAME);
  • if (attr && strcmp(attr->values[0].string.text, "no-hold"))
  • {
  • /*
  • * Return the job to a held state...
  • */
  • cupsdLogMessage(CUPSD_LOG_DEBUG,
  •           "[Job %d] Restarted by \"%s\" with job-hold-until=%s.",
    
  •                job->id, username, attr->values[0].string.text);
    
  • cupsdSetJobHoldUntil(job, attr->values[0].string.text);
  • cupsdAddEvent(CUPSD_EVENT_JOB_CONFIG_CHANGED | CUPSD_EVENT_JOB_STATE,
  •              NULL, job, "Job restarted by user with job-hold-until=%s",
    
  •     attr->values[0].string.text);
    
  • }
  • else
  • {
  • /*
  • * Restart the job...
  • */
  • cupsdRestartJob(job);
  • }

cupsdLogMessage(CUPSD_LOG_INFO, "[Job %d] Restarted by "%s".", jobid,
username);

Collaborator

michaelrsweet commented Mar 18, 2009

"str3130.patch":

Index: scheduler/ipp.c

--- scheduler/ipp.c (revision 8449)
+++ scheduler/ipp.c (working copy)
@@ -9307,12 +9307,12 @@
{
ipp_attribute_t attr; / Current attribute /
int jobid; /
Job ID */

  • cupsd_job_t job; / Job information /
    char scheme[HTTP_MAX_URI], /
    Method portion of URI /
    username[HTTP_MAX_URI], /
    Username portion of URI /
    host[HTTP_MAX_URI], /
    Host portion of URI /
    resource[HTTP_MAX_URI]; /
    Resource portion of URI /
    int port; /
    Port portion of URI */
  • cupsd_job_t job; / Job information */

cupsdLogMessage(CUPSD_LOG_DEBUG2, "restart_job(%p[%d], %s)", con,
@@ -9420,11 +9420,37 @@
}

/*

  • * Restart the job and return...
    • See if the job-hold-until attribute is specified...
      */
  • cupsdRestartJob(job);
  • if ((attr = ippFindAttribute(con->request, "job-hold-until",
  •                           IPP_TAG_KEYWORD)) == NULL)
    
  • attr = ippFindAttribute(con->request, "job-hold-until", IPP_TAG_NAME);
  • if (attr && strcmp(attr->values[0].string.text, "no-hold"))
  • {
  • /*
  • * Return the job to a held state...
  • */
  • cupsdLogJob(job, CUPSD_LOG_DEBUG,
  •   "Restarted by \"%s\" with job-hold-until=%s.",
    
  •            username, attr->values[0].string.text);
    
  • cupsdSetJobHoldUntil(job, attr->values[0].string.text, 0);
  • cupsdAddEvent(CUPSD_EVENT_JOB_CONFIG_CHANGED | CUPSD_EVENT_JOB_STATE,
  •              NULL, job, "Job restarted by user with job-hold-until=%s",
    
  •     attr->values[0].string.text);
    
  • }
  • else
  • {
  • /*
  • * Restart the job...
  • */
  • cupsdRestartJob(job);
  • }

cupsdLogJob(job, CUPSD_LOG_INFO, "Restarted by "%s".", username);

con->response->request.status.status_code = IPP_OK;

michaelrsweet added this to the Stable milestone Mar 17, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment