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.

IPP backend fails to trigger authentication prompts when a username/password is required #3985

Closed

Description

@michaelrsweet

Version: 1.5.0
CUPS.org User: rb12345

When printing from an Ubuntu client running CUPS 1.5 to a server requiring authentication, no prompting occurs for username and password. Originally, the bug was reported at https://bugs.launchpad.net/ubuntu/+source/cups/+bug/879625, and applied to connections over TLS. This looks almost like a duplicate of STR #3933. Unlike STR #3933, I have also replicated this behaviour without SSL.

The problem here seems to be with backend/ipp.c. After the Kerberos support was added, the auth_info_required variable was left blank by default. This is used to generate the "ATTR: auth_info_required=%s" text that specifies the authentication method needed. In the case of Kerberos authentication, this is set to "negotiate", but when non-Kerberos methods are used, this now remains unset, unlike CUPS 1.4. The attached patch restores the "username,password" text that is needed to trigger the authentication prompt, and works for applications in Ubuntu. There is no reason to think that this would not work for RedHat 5.7 too.

Activity

  1. michaelrsweet commented on Feb 11, 2012

    @michaelrsweet
    ContributorAuthor

    CUPS.org User: mike

    This patch is not correct; it will set auth-info-required to username,password even if the WWW-Authenticate header is blank.

    What needs to happen is for the password callback to be set unconditionally - right now we only set auth_info_required to username,password when a username or password is passed in the URI or environment already...

  2. michaelrsweet commented on Feb 11, 2012

    @michaelrsweet
    ContributorAuthor

    CUPS.org User: mike

    Actually, we are already setting the password callback unconditionally...

    An alternate patch is attached that looks at the WWW-Authenticate header...

  3. michaelrsweet commented on Feb 11, 2012

    @michaelrsweet
    ContributorAuthor

    "ipp-bug-879625-1.patch":

    === modified file 'backend/ipp.c'
    --- old/backend/ipp.c 2011-10-27 23:13:49 +0000
    +++ new/backend/ipp.c 2011-10-31 23:41:56 +0000
    @@ -896,6 +896,8 @@
    if (!strncmp(httpGetField(http, HTTP_FIELD_WWW_AUTHENTICATE),
    "Negotiate", 9))
    auth_info_required = "negotiate";

    • else

    • auth_info_required = "username,password";
      

      fprintf(stderr, "ATTR: auth-info-required=%s\n", auth_info_required);
      return (CUPS_BACKEND_AUTH_REQUIRED);
      @@ -1268,6 +1270,8 @@
      if (!strncmp(httpGetField(http, HTTP_FIELD_WWW_AUTHENTICATE),
      "Negotiate", 9))
      auth_info_required = "negotiate";

    •   else
      
    •     auth_info_required = "username,password";
      

      goto cleanup;
      }
      @@ -1431,6 +1435,8 @@
      if (!strncmp(httpGetField(http, HTTP_FIELD_WWW_AUTHENTICATE),
      "Negotiate", 9))
      auth_info_required = "negotiate";

    • else
      
    •   auth_info_required = "username,password";
      

      }
      else
      sleep(10);

  4. michaelrsweet commented on Feb 11, 2012

    @michaelrsweet
    ContributorAuthor

    "str3985.patch":

    Index: backend/ipp.c

    --- backend/ipp.c (revision 10249)
    +++ backend/ipp.c (working copy)
    @@ -898,9 +898,13 @@
    }
    else if (ipp_status == IPP_NOT_AUTHORIZED || ipp_status == IPP_FORBIDDEN)
    {

    • if (!strncmp(httpGetField(http, HTTP_FIELD_WWW_AUTHENTICATE),

    •        "Negotiate", 9))
      
    •    const char *www_auth = httpGetField(http, HTTP_FIELD_WWW_AUTHENTICATE);
      
    •                   /\* WWW-Authenticate field value */
      
    • if (!strncmp(www_auth, "Negotiate", 9))
      auth_info_required = "negotiate";

    •    else if (www_auth[0])
      
    •      auth_info_required = "username,password";
      

      fprintf(stderr, "ATTR: auth-info-required=%s\n", auth_info_required);
      return (CUPS_BACKEND_AUTH_REQUIRED);
      @@ -1277,23 +1281,13 @@
      else if (ipp_status == IPP_NOT_AUTHORIZED || ipp_status == IPP_FORBIDDEN ||
      ipp_status == IPP_AUTHENTICATION_CANCELED)
      {

    • /*
      
    •  \* Update auth-info-required as needed...
      
    •  */
      
    •  const char *www_auth = httpGetField(http, HTTP_FIELD_WWW_AUTHENTICATE);
      
    •               /* WWW-Authenticate field value */
      
    •  fprintf(stderr, "DEBUG: WWW-Authenticate=\"%s\"\n",
      

    - httpGetField(http, HTTP_FIELD_WWW_AUTHENTICATE));

    • /*
      
    •  \* Normal authentication goes through the password callback, which sets
      
    •  \* auth_info_required to "username,password".  Kerberos goes directly
      
    •  \* through GSSAPI, so look for Negotiate in the WWW-Authenticate header
      
    •  \* here and set auth_info_required as needed...
      

    - */

    •  if (!strncmp(httpGetField(http, HTTP_FIELD_WWW_AUTHENTICATE),
      
    •      "Negotiate", 9))
      
    •  if (!strncmp(www_auth, "Negotiate", 9))
      

      auth_info_required = "negotiate";

    •  else if (www_auth[0])
      
    • auth_info_required = "username,password";

      goto cleanup;
      }
      @@ -1455,19 +1449,13 @@

    if (ipp_status == IPP_NOT_AUTHORIZED || ipp_status == IPP_FORBIDDEN)
    {

    • fprintf(stderr, "DEBUG: WWW-Authenticate=\"%s\"\n",
      

    - httpGetField(http, HTTP_FIELD_WWW_AUTHENTICATE));

    •     /*
      
    • \* Normal authentication goes through the password callback, which sets
      
    • \* auth_info_required to "username,password".  Kerberos goes directly
      
    • \* through GSSAPI, so look for Negotiate in the WWW-Authenticate header
      
    • \* here and set auth_info_required as needed...
      

    - */

    • if (!strncmp(httpGetField(http, HTTP_FIELD_WWW_AUTHENTICATE),
      
    •          "Negotiate", 9))
      
    • const char *www_auth = httpGetField(http, HTTP_FIELD_WWW_AUTHENTICATE);
      
    •               /\* WWW-Authenticate field value */
      
    • if (!strncmp(www_auth, "Negotiate", 9))
      auth_info_required = "negotiate";
      
    • else if (www_auth[0])
      
    •   auth_info_required = "username,password";
      
      }
      else if (ipp_status == IPP_REQUEST_VALUE)
      {
  5. 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