Autodetected LPD printers cannot detect or change print queue name via web interface #3755

Closed
michaelrsweet opened this Issue Dec 20, 2010 · 2 comments

Projects

None yet

1 participant

@michaelrsweet
Collaborator

Version: 1.4.2
CUPS.org User: mtin

There is a bug with the way the CUPS web administration portal(the interface on http://localhost:631) handles autodetected CUPS printers, if that printer only allows LPD printing.

Normally, LPD printers have a URI of lpd://:/queuename. /usr/lib/cups/backend/lpd more specifically will NOT allow you to print without a queuename attached.

The problem is that OpenSolaris CUPS (or maybe CUPS in general) has when it autodetects network printers is that it is impossible to edit the printer URI once it has been "detected" by the CUPS web interface. When you use the autodetect my printer feature, it fill outs the URI as lpd://:port, but it misses detecting the LPD queue name. It is also impossible to modify it from the web interface from the printer administration page. At no point does it even bother to ask you what the queue names are after it autodetects the printer as an LPD printer, nor does it warn you that you need to fill in a queue name. Instead, it silently happily accepts the auto-detected configuration and tries to print, at which point it bombs out.

It fails with some obscure message of:
D [01/Oct/2010:15:21:43 +0800] [Job 3] lpd_command returning -1
D [01/Oct/2010:15:21:43 +0800] [Job 3] Backend returned status 1 (failed)
D [01/Oct/2010:15:21:43 +0800] [Job 3] Printer stopped due to backend errors; please consult the error_log file for details.
D [01/Oct/2010:15:21:43 +0800] [Job 3] End of messages
D [01/Oct/2010:15:21:43 +0800] [Job 3] printer-state=5(stopped)
D [01/Oct/2010:15:21:43 +0800] [Job 3] printer-state-message="/usr/lib/cups/backend/lpd failed"

The solution I have found is to add the printer manually as an LPD/LPR printer, at which case you can fill in the LPD URI.

The only reason I solved this problem is that at this point, the CUPS interface shows you an example of an LPD URI which looks like:

lpd://hostname/queue

At that point, I could print quite happily and all was fine. CUPS should warn you at even after it autodetects the LPD IP address, it still requires a queue name to complete the add process. I kind of assumed that CUPS had some sort of default queue name or something, but clearly this is not the case. And on a second note, the CUPS printer URI should be editable in the modify printer administration option.

@michaelrsweet
Collaborator

CUPS.org User: mike

Fixed in Subversion repository.

The issue is more that SNMP-based auto-detection cannot always find the queue name to use, but the attached patch checks for lpd://hostname without a queue name and shows the manual URI entry form if so...

@michaelrsweet
Collaborator

"str3755.patch":

Index: cgi-bin/admin.c

--- cgi-bin/admin.c (revision 9428)
+++ cgi-bin/admin.c (working copy)
@@ -1,9 +1,9 @@
/*

  • "$Id$"
    *
    • * Administration CGI for the Common UNIX Printing System (CUPS).
    • * Administration CGI for CUPS.
      *
    • * Copyright 2007-2010 by Apple Inc.
    • * Copyright 2007-2011 by Apple Inc.
  • Copyright 1997-2007 by Easy Software Products.
  • These coded instructions, statements, and computer programs are the
    @@ -1040,7 +1040,8 @@
    }
    }
    }
  • else if (strchr(var, '/') == NULL)
  • else if (!strchr(var, '/') ||
  •       (!strncmp(var, "lpd://", 6) && !strchr(var + 6, '/')))
    
    {
    if ((attr = ippFindAttribute(oldinfo, "device-uri", IPP_TAG_URI)) != NULL)
    {
@michaelrsweet 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