CUPS-Get-Printers and auth-info-required #4205

Closed
michaelrsweet opened this Issue Oct 9, 2012 · 6 comments

Comments

Projects
None yet
1 participant
Collaborator

michaelrsweet commented Oct 9, 2012

Version: 1.3.11
CUPS.org User: dagorn

I'm experiencing problem with a cup 1.3.11 but I've seen some posts about same
problem with more recent versions. So what happens :

  • involved : client using recent GTK as user interface (firefox, ...)
  • GTK first asks for a list of available printers and then provide a menu
    to choose a relevant one

What cups does when a printer is allowed for some networks and auth basic otherwise : cups sends an auth-info-required : username .. password instead
of "none" when the request comes from a trusted network. So GTK prompts for
a password.

GTK people says they are right since the server give a false information.
Of course people printing out of GTK are not affected I guess they are not
"CUPS-Get-Printers " to determine wether or not a password is needed, they
probably wait for an auth HTTP request ?

Any help would be appreciated, specially to walk on the cups sources, hard to
find where this confounded "auth-info-required: username" is done ...

Cheers.

François Dagorn
Université de Rennes 1
France

Collaborator

michaelrsweet commented Oct 9, 2012

CUPS.org User: mike

Francois,

The auth-info-required attribute should only be set for remote authentication these days. Can you try printing using a more recent version of CUPS?

Collaborator

michaelrsweet commented Oct 9, 2012

CUPS.org User: dagorn

Michael,

we are using a local backend, the author as gone and the backend is not
suitable for cups 1.6 (could not find job, I guess backend API as changed).
So I'm currently in a dead lock.

What I want to do : printers are opened without authentication for workstations
located on our wired network and need authentication for student personal laptops.
This is done in cupsd.conf with a "satisfy Any".

Do you mean using 1.4 will fix my problem ?
I'm sure 1.6 is not relevant but may be the backend API has not changed between 1.3 and 1.4 ?

Cheers.

Collaborator

michaelrsweet commented Oct 9, 2012

CUPS.org User: dagorn

Installed 1.4.8 but :

[09/Oct/2012:16:33:12 +0200] [Job ???] Request file type is application/postscript.
E [09/Oct/2012:16:33:12 +0200] Returning IPP client-error-document-format-not-supported for Print-Job

The last Ghostscript is installed ...

Collaborator

michaelrsweet commented Oct 11, 2012

CUPS.org User: dagorn

To get GTK-2 tools print well (without requesting password when the user is
located on a trusted network), the following patch is relevant for all cups
versions :

char resource[HTTP_MAX_URI]; /* Resource portion of URI /
/
comment out line 1822 in scheduler/printers.c
ippAddStrings(p->attrs,IPP_TAG_PRINTER,IPP_TAG_KEYWORD, "auth-info-required", num_air, NULL, air);
*/

When this patch is on, trusted workstations are allowed to print.
Non trusted (Linux only) workstations are not able to print, cups does the
job of requesting credentials (WWW-authenticate) but GTK-2 tools like
firefox, gimp, ... are not able to prompt for credentials (and the print button
is grayed).

This is less painly.

Hope this help.

François

Collaborator

michaelrsweet commented Dec 12, 2012

CUPS.org User: mike

Fixed in Subversion repository.

Patch attached; basically, we can't just comment out that one line, but we should only be setting auth-info-required when the queue is configured to require third-party authentication.

Collaborator

michaelrsweet commented Dec 12, 2012

"str4205.patch":

Index: scheduler/printers.c

--- scheduler/printers.c (revision 10748)
+++ scheduler/printers.c (working copy)
@@ -2030,23 +2030,12 @@
{
int i; /* Looping var /
char resource[HTTP_MAX_URI]; /
Resource portion of URI */

  • int num_air; /* Number of auth-info-required values */

  • const char * const air; / auth-info-required values /
    cupsd_location_t *auth; /
    Pointer to authentication element /
    const char *auth_supported; /
    Authentication supported /
    ipp_t *oldattrs; /
    Old printer attributes /
    ipp_attribute_t *attr; /
    Attribute data /
    char *name, /
    Current user/group name /
    *filter; /
    Current filter */

  • static const char * const air_none[] =

  •   {           /\* No authentication */
    
  •     "none"
    
  •   };
    
  • static const char * const air_userpass[] =

  •   {           /\* Basic/Digest authentication */
    
  •     "username",
    
  •     "password"
    
  •   };
    

    DEBUG_printf(("cupsdSetPrinterAttrs: entering name = %s, type = %x\n", p->name,
    @@ -2070,20 +2059,7 @@
    */

    auth_supported = "requesting-user-name";

  • num_air = 1;

  • air = air_none;

  • if (p->num_auth_info_required > 0 && strcmp(p->auth_info_required[0], "none"))

  • {

  • num_air = p->num_auth_info_required;

  • air = p->auth_info_required;

  • }

  • else if (p->type & CUPS_PRINTER_AUTHENTICATED)

  • {

  • num_air = 2;

  • air = air_userpass;

- }

if (p->type & CUPS_PRINTER_CLASS)
snprintf(resource, sizeof(resource), "/classes/%s", p->name);
else
@@ -2161,8 +2137,10 @@
"job-k-limit", p->k_limit);
ippAddInteger(p->attrs, IPP_TAG_PRINTER, IPP_TAG_INTEGER,
"job-page-limit", p->page_limit);

  • ippAddStrings(p->attrs, IPP_TAG_PRINTER, IPP_TAG_KEYWORD,

  •   "auth-info-required", num_air, NULL, air);
    
  • if (p->num_auth_info_required > 0 && strcmp(p->auth_info_required[0], "none"))

  • ippAddStrings(p->attrs, IPP_TAG_PRINTER, IPP_TAG_KEYWORD,

  •     "auth-info-required", p->num_auth_info_required, NULL,
    
  •     p->auth_info_required);
    

    if (cupsArrayCount(Banners) > 0)
    {

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