Skip to content
This repository was archived by the owner on Mar 10, 2026. It is now read-only.
This repository was archived by the owner on Mar 10, 2026. It is now read-only.

Double "job-name" attribute #3428

Closed
Closed

Description

@michaelrsweet

Version: 1.4-current
CUPS.org User: pkun

Every job has two "job-name" attributes.
The bug is in the ipp.h add_job() function.
The first setting of job-name is:
if ((attr = ippFindAttribute(con->request, "job-name",
IPP_TAG_NAME)) != NULL)
title = attr->values[0].string.text;
else
ippAddString(con->request, IPP_TAG_JOB, IPP_TAG_NAME, "job-name", NULL,
title = "Untitled");
And the second setting is:
ippAddString(job->attrs, IPP_TAG_JOB, IPP_TAG_NAME, "job-name", NULL,
title);

The simple patch for cups 1.4.1:

Index: cups/scheduler/ipp.c

--- cups.orig/scheduler/ipp.c 2009-11-20 21:47:40.000000000 +0300
+++ cups/scheduler/ipp.c 2009-11-20 21:49:20.000000000 +0300
@@ -1706,8 +1706,8 @@ add_job(cupsd_client_t con, / I - Cl
"job-media-sheets-completed", 0);
ippAddString(job->attrs, IPP_TAG_JOB, IPP_TAG_URI, "job-printer-uri", NULL,
printer->uri);

  • ippAddString(job->attrs, IPP_TAG_JOB, IPP_TAG_NAME, "job-name", NULL,

  •           title);
    

    +// ippAddString(job->attrs, IPP_TAG_JOB, IPP_TAG_NAME, "job-name", NULL,
    +// title);

    if ((attr = ippFindAttribute(job->attrs, "job-k-octets",
    IPP_TAG_INTEGER)) != NULL)

Activity

  1. michaelrsweet commented on Dec 8, 2009

    @michaelrsweet
    ContributorAuthor

    CUPS.org User: mike

    Fixed in Subversion repository.

  2. michaelrsweet commented on Dec 8, 2009

    @michaelrsweet
    ContributorAuthor

    "str3428.patch":

    Index: scheduler/ipp.c

    --- scheduler/ipp.c (revision 8900)
    +++ scheduler/ipp.c (working copy)
    @@ -1706,8 +1706,6 @@
    "job-media-sheets-completed", 0);
    ippAddString(job->attrs, IPP_TAG_JOB, IPP_TAG_URI, "job-printer-uri", NULL,
    printer->uri);

    • ippAddString(job->attrs, IPP_TAG_JOB, IPP_TAG_NAME, "job-name", NULL,

    •           title);
      

      if ((attr = ippFindAttribute(job->attrs, "job-k-octets",
      IPP_TAG_INTEGER)) != NULL)
      @@ -3199,7 +3197,7 @@
      num_profiles ++;
      }

      /*

      • If we have profiles, add them...
        */
        @@ -3245,7 +3243,7 @@
        snprintf(q_keyword, sizeof(q_keyword), "Default%s", attr->value);
        q2_attr = ppdFindAttr(ppd, q_keyword, NULL);
        }
    •  else 
      
    •  else
      

      q2_attr = ppdFindAttr(ppd, "DefaultMediaType", NULL);

      if (q2_attr && q2_attr->value && q2_attr->value[0])
      @@ -3259,7 +3257,7 @@
      snprintf(q_keyword, sizeof(q_keyword), "Default%s", attr->value);
      q3_attr = ppdFindAttr(ppd, q_keyword, NULL);
      }

    •  else 
      
    •  else
      

      q3_attr = ppdFindAttr(ppd, "DefaultResolution", NULL);

      if (q3_attr && q3_attr->value && q3_attr->value[0])
      @@ -3428,7 +3426,7 @@
      attr = ppdFindAttr(ppd, "DefaultColorSpace", NULL);

      num_profiles = (attr && ppd->colorspace == PPD_CS_GRAY) ? 1 : 2;

      if ((profiles = calloc(num_profiles, sizeof(CMDeviceProfileArray))) == NULL)
      {
      cupsdLogMessage(CUPSD_LOG_ERROR,
      @@ -4426,7 +4424,7 @@
      if (q->page_count == -4) /* special case: unlimited user */
      {
      cupsdLogMessage(CUPSD_LOG_INFO,

    •                  "User \"%s\" request approved for printer %s (%s): " 
      
    •                  "User \"%s\" request approved for printer %s (%s): "
            "unlimited quota.",
            username, p->name, p->info);
      

      q->page_count = 0; /* allow user to print */

  3. added this to the Stable milestone on Mar 17, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions