cups lpd emulation: lpq, log flaws

Bug #136454 reported by John DiMarco
2
Affects Status Importance Assigned to Milestone
cupsys (Ubuntu)
Invalid
Undecided
Unassigned

Bug Description

Binary package hint: cupsys

In cupsys-1.2.2-0ubuntu0.6.06, when running cups-lpd to provide lpd printing emulation via cups, at least two aspects of cups lpd emulation work incorrectly:

1: When using lpq on a remote machine to query a cups printer, the following is reported, regardless of the status of the printer:
"lw is not ready" (where "lw" is the name of the printer).

2: When a print job is reported in /var/log/cups/page_log, the portion of the log entry that is supposed to show the IP address or hostname of the remote machine shows instead
an ascii 001, i.e. instead of:

lw jdd 2515 [31/Aug/2007:10:55:52 -0400] 1 1 - 128.100.5.251
it shows:
lw jdd 2515 [31/Aug/2007:10:55:52 -0400] 1 1 - ^A

(where ^A is control-A, i.e. ascii character 001)

There is a straightforward source patch: simply replace cupsys-1.2.2/scheduler/cups-lpd.c with the equivalent from cups 1.2.12, and both problems are eliminated.

I've appended a patch below.

Regards,

John
--
John DiMarco <email address hidden> Office: SF3302B
IT Director Phone: 416-978-5300
Department of Computer Science, University of Toronto Fax: 416-946-5464
http://www.cs.toronto.edu/~jdd
*** cups-lpd.c 2007/08/31 19:20:20 1.1
--- cups-lpd.c 2007/08/31 19:20:56

***************
*** 96,102 ****
                            int destsize, cups_option_t **options,
                            int *accepting, int *shared, ipp_pstate_t *state);
  static int print_file(http_t *http, int id, const char *filename,
! const char *docname, const char *user, int last);
  static int recv_print_job(const char *name, int num_defaults,
                               cups_option_t *defaults);
  static int remove_jobs(const char *name, const char *agent,
--- 96,103 ----
                            int destsize, cups_option_t **options,
                            int *accepting, int *shared, ipp_pstate_t *state);
  static int print_file(http_t *http, int id, const char *filename,
! const char *docname, const char *user,
! const char *format, int last);
  static int recv_print_job(const char *name, int num_defaults,
                               cups_option_t *defaults);
  static int remove_jobs(const char *name, const char *agent,
***************
*** 150,157 ****
    num_defaults = 0;
    defaults = NULL;
    hostlookups = 1;
- num_defaults = cupsAddOption("job-originating-host-name", hostname,
- num_defaults, &defaults);

    for (i = 1; i < argc; i ++)
      if (argv[i][0] == '-')
--- 151,156 ----
***************
*** 217,222 ****
--- 216,224 ----
             hostip);
    }

+ num_defaults = cupsAddOption("job-originating-host-name", hostname,
+ num_defaults, &defaults);
+
   /*
    * RFC1179 specifies that only 1 daemon command can be received for
    * every connection.
***************
*** 471,477 ****

      request = ippNewRequest(CUPS_GET_PRINTERS);

! ippAddStrings(request, IPP_TAG_OPERATION, IPP_TAG_NAME,
                    "requested-attributes",
                  (int)(sizeof(requested) / sizeof(requested[0])),
                    NULL, requested);
--- 473,479 ----

      request = ippNewRequest(CUPS_GET_PRINTERS);

! ippAddStrings(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD,
                    "requested-attributes",
                  (int)(sizeof(requested) / sizeof(requested[0])),
                    NULL, requested);
***************
*** 597,603 ****
      ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri",
                 NULL, uri);

! ippAddStrings(request, IPP_TAG_OPERATION, IPP_TAG_NAME,
                    "requested-attributes",
                  (int)(sizeof(requested) / sizeof(requested[0])),
                    NULL, requested);
--- 599,605 ----
      ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri",
                 NULL, uri);

! ippAddStrings(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD,
                    "requested-attributes",
                  (int)(sizeof(requested) / sizeof(requested[0])),
                    NULL, requested);
***************
*** 648,654 ****
      if (state)
      {
        if ((attr = ippFindAttribute(response, "printer-state",
! IPP_TAG_INTEGER)) == NULL)
        syslog(LOG_ERR, "No printer-state attribute found in "
                        "response from server!");
        else
--- 650,656 ----
      if (state)
      {
        if ((attr = ippFindAttribute(response, "printer-state",
! IPP_TAG_ENUM)) == NULL)
        syslog(LOG_ERR, "No printer-state attribute found in "
                        "response from server!");
        else
***************
*** 823,828 ****
--- 825,831 ----
           const char *filename, /* I - File to print */
             const char *docname, /* I - document-name */
           const char *user, /* I - requesting-user-name */
+ const char *format, /* I - document-format */
           int last) /* I - 1 = last file in job */
  {
    ipp_t *request; /* IPP request */
***************
*** 845,850 ****
--- 848,857 ----
      ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME,
                 "document-name", NULL, docname);

+ if (format)
+ ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_MIMETYPE,
+ "document-format", NULL, format);
+
    if (last)
      ippAddBoolean(request, IPP_TAG_OPERATION, "last-document", 1);

***************
*** 1277,1282 ****
--- 1284,1291 ----
                docnumber ++;

                if (print_file(http, id, temp[i], docname, user,
+ cupsGetOption("document-format", num_options,
+ options),
                               docnumber == doccount))
                    status = 1;
                else
***************
*** 1387,1393 ****
        return (1);
      }
      else
! syslog(LOG_INFO, "Job ID %d cancelled", id);
    }

    httpClose(http);
--- 1396,1402 ----
        return (1);
      }
      else
! syslog(LOG_INFO, "Job ID %d canceled", id);
    }

    httpClose(http);

Revision history for this message
Charlie Kravetz (cjkgeek) wrote :

Thanks for reporting this bug and any supporting documentation. Since this bug has enough information provided for a developer to begin work, I'm going to mark it as confirmed and let them handle it from here.
Thank you for including the patch with this report.

Thanks for taking the time to make Ubuntu better!

Changed in cupsys:
status: New → Confirmed
Revision history for this message
Phillip Susi (psusi) wrote :

Hardy has reached end of life, and this package is not present in later releases. Closing all related bugs.

Changed in cupsys (Ubuntu):
status: Confirmed → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.