STR 2996 breaks lpq #3117

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

Comments

Projects
None yet
1 participant
Collaborator

michaelrsweet commented Mar 5, 2009

Version: 1.3-current
CUPS.org User: opher

Hello,
lpq (berkeley/lpq.c) is wrongly sending job-uri=ipp://localhost/jobs to get all jobs. STR #2996 breaks this functionality.
Also, specifying a printer and a job-id (on the command-line) would cause an error. The code design seems to opt for ignoring job-id in this case.

A patch is attached that changes the code in line with STR #3107.

Regards,
Opher.

Collaborator

michaelrsweet commented Mar 5, 2009

CUPS.org User: mike

Fixed in Subversion repository.

Collaborator

michaelrsweet commented Mar 5, 2009

"lpq-all-jobs.patch":

This patch file was generated by NetBeans IDE

Following Index: paths are relative to: H:\My Documents\Projects\CUPS\cups-1.3.x\berkeley

This patch can be applied using context Tools: Patch action on respective folder.

It uses platform neutral UTF-8 encoding and \n newlines.

Above lines and this line are ignored by the patching process.

Index: lpq.c
--- lpq.c Base (BASE)
+++ lpq.c Locally Modified (Based On LOCAL)
@@ -370,23 +370,23 @@

  • job-uri or printer-uri
    */

- request = ippNewRequest(id ? IPP_GET_JOB_ATTRIBUTES : IPP_GET_JOBS);

  • if (dest == NULL)
  • if (dest == NULL && id)
    {
  • if (id)
  •  sprintf(resource, "ipp://localhost/jobs/%d", id);
    
  • else
  •  strcpy(resource, "ipp://localhost/jobs");
    
  • sprintf(resource, "ipp://localhost/jobs/%d", id);
  • request = ippNewRequest(IPP_GET_JOB_ATTRIBUTES);
    ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "job-uri",
    NULL, resource);
    }
    else
    {
  • httpAssembleURIf(HTTP_URI_CODING_ALL, resource, sizeof(resource), "ipp",
  • if (dest)
  •  httpAssembleURIf(HTTP_URI_CODING_ALL, resource, sizeof(resource), "ipp",
                  NULL, "localhost", 0, "/printers/%s", dest);
    
  • else
  •  strcpy(resource, "ipp://localhost/");
    
  • request = ippNewRequest(IPP_GET_JOBS);
    ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri",
    NULL, resource);
    }
Collaborator

michaelrsweet commented Mar 5, 2009

"str3117.patch":

Index: berkeley/lpq.c

--- berkeley/lpq.c (revision 8404)
+++ berkeley/lpq.c (working copy)
@@ -3,7 +3,7 @@
*

  • "lpq" command for the Common UNIX Printing System (CUPS).
  • * Copyright 2007-2008 by Apple Inc.
  • * Copyright 2007-2009 by Apple Inc.
  • Copyright 1997-2006 by Easy Software Products.
  • These coded instructions, statements, and computer programs are the
    @@ -372,17 +372,13 @@

request = ippNewRequest(id ? IPP_GET_JOB_ATTRIBUTES : IPP_GET_JOBS);

  • if (dest == NULL)
  • if (id)
    {
  • if (id)
  •  sprintf(resource, "ipp://localhost/jobs/%d", id);
    
  • else

- strcpy(resource, "ipp://localhost/jobs");

  • snprintf(resource, sizeof(resource), "ipp://localhost/jobs/%d", id);
    ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "job-uri",
    NULL, resource);
    }

  • else

  • else if (dest)
    {
    httpAssembleURIf(HTTP_URI_CODING_ALL, resource, sizeof(resource), "ipp",
    NULL, "localhost", 0, "/printers/%s", dest);
    @@ -390,6 +386,9 @@
    ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri",
    NULL, resource);
    }

  • else

  • ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri",

  •             NULL, "ipp://localhost/");
    

    if (user)
    {

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