~ubuntu-branches/ubuntu/trusty/cups/trusty

« back to all changes in this revision

Viewing changes to backend/ipp.c

  • Committer: Package Import Robot
  • Author(s): Didier Raboud, Didier Raboud, Brian Potkin
  • Date: 2013-07-18 21:45:15 UTC
  • mfrom: (99.1.22 sid)
  • Revision ID: package-import@ubuntu.com-20130718214515-uqo4350nrs0pwy74
* New 1.6.3 upstream release:
  - The lp, lpq, lpr, and lpstat now display an error message advising the
    use of the /version=1.1 ServerName option (<rdar://problem/14290628>)
  - Added documentation about the /version=1.1 option to ServerName in
    client.conf (<rdar://problem/14216262>)
  - httpStatus(HTTP_ERROR) did not return a useful error message
    (Closes: #645436)
  - The lp, lpq, lpr, and lpstat commands incorrectly ignored the default
    printer set in the lpoptions file (Closes: #711848)
  - The USB backend could crash on libusb-based systems if USB was
    disabled in the BIOS (LP: #1108719).
  - Added more USB quirks for the libusb-based backend
  - The scheduler no longer tries to do Kerberos authentication over the
    loopback interface. (Closes: #640939).

[ Didier Raboud ]
* Refresh patches for 1.6.3:
  - usb-backend-more-quirk-rules: Shrink to only Lexmark E238 that
    missed 1.6.3 merge window
  - usb-backend-do-not-crash-if-usb-disabled-in-bios: Shrink to only
    keep the error counting exception.
  - remove-unreal-printers: Drop, was from upstream.
  - more-verbose-http-error-message: Drop, was from upstream.
  - mention-ipp-version-specifier-in-man-and-ref: Drop, differently
    included upstream. (Closes: #711848)
* Invert symlink handling in cups-client's preinst to cope with the
  symlink-to-directory migration for /usr/share/doc. (Closes: #716867)
* Update usb backend quirks to fix Lexmark E238 printer (Closes: #716843)
* Get dpkg-maintscript-helper to delete /e/c/acroread.conf and
  /e/c/pdftops.conf again in 1.6.2-9~ to cleanup upgrades from cups
  1.5. (Closes: #711136)
* Update debian/watch to cope with the new cups.org layout

[ Brian Potkin ]
* Rewrite README.Debian for Jessie (>= 1.6) (Closes: #714852)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
 
 * "$Id: ipp.c 10890 2013-03-08 18:42:09Z mike $"
 
2
 * "$Id: ipp.c 9759 2011-05-11 03:24:33Z mike $"
3
3
 *
4
4
 *   IPP backend for CUPS.
5
5
 *
6
 
 *   Copyright 2007-2012 by Apple Inc.
 
6
 *   Copyright 2007-2013 by Apple Inc.
7
7
 *   Copyright 1997-2007 by Easy Software Products, all rights reserved.
8
8
 *
9
9
 *   These coded instructions, statements, and computer programs are the
100
100
                                        /* Username for device URI */
101
101
                        *password = NULL;
102
102
                                        /* Password for device URI */
103
 
static int              password_tries = 0;
104
 
                                        /* Password tries */
105
103
static const char * const pattrs[] =    /* Printer attributes we want */
106
104
{
107
105
  "copies-supported",
166
164
                                     const char *format, _ppd_cache_t *pc,
167
165
                                     ipp_attribute_t *media_col_sup,
168
166
                                     ipp_attribute_t *doc_handling_sup);
169
 
static const char       *password_cb(const char *);
 
167
static const char       *password_cb(const char *prompt, http_t *http,
 
168
                                     const char *method, const char *resource,
 
169
                                     int *user_data);
170
170
static void             report_attr(ipp_attribute_t *attr);
171
171
static void             report_printer_state(ipp_t *ipp);
172
172
#if defined(HAVE_GSSAPI) && defined(HAVE_XPC)
203
203
                *name,                  /* Name of option */
204
204
                *value,                 /* Value of option */
205
205
                sep;                    /* Separator character */
 
206
  int           password_tries = 0;     /* Password tries */
206
207
  http_addrlist_t *addrlist;            /* Address of printer */
207
208
  int           snmp_enabled = 1;       /* Is SNMP enabled? */
208
209
  int           snmp_fd,                /* SNMP socket */
406
407
  if (!port)
407
408
    port = IPP_PORT;                    /* Default to port 631 */
408
409
 
409
 
  if (!strcmp(scheme, "https"))
 
410
  if (!strcmp(scheme, "https") || !strcmp(scheme, "ipps"))
410
411
    cupsSetEncryption(HTTP_ENCRYPT_ALWAYS);
411
412
  else
412
413
    cupsSetEncryption(HTTP_ENCRYPT_IF_REQUESTED);
607
608
  * Set the authentication info, if any...
608
609
  */
609
610
 
610
 
  cupsSetPasswordCB(password_cb);
 
611
  cupsSetPasswordCB2((cups_password_cb2_t)password_cb, &password_tries);
611
612
 
612
613
  if (username[0])
613
614
  {
1896
1897
 
1897
1898
      ippDelete(response);
1898
1899
 
 
1900
      if (cupsLastError() <= IPP_OK_CONFLICT)
 
1901
        password_tries = 0;
 
1902
 
1899
1903
     /*
1900
1904
      * Wait before polling again...
1901
1905
      */
1919
1923
 
1920
1924
  check_printer_state(http, uri, resource, argv[2], version);
1921
1925
 
 
1926
  if (cupsLastError() <= IPP_OK_CONFLICT)
 
1927
    password_tries = 0;
 
1928
 
1922
1929
 /*
1923
1930
  * Collect the final page count as needed...
1924
1931
  */
2094
2101
  fprintf(stderr, "DEBUG: Get-Printer-Attributes: %s (%s)\n",
2095
2102
          ippErrorString(cupsLastError()), cupsLastErrorString());
2096
2103
 
2097
 
  if (cupsLastError() <= IPP_OK_CONFLICT)
2098
 
    password_tries = 0;
2099
 
 
2100
2104
 /*
2101
2105
  * Return the printer-state value...
2102
2106
  */
2195
2199
  const char    *job_name;              /* Job name */
2196
2200
  ipp_jstate_t  job_state;              /* Job state */
2197
2201
  const char    *job_user;              /* Job originating user name */
 
2202
  int           password_tries = 0;     /* Password tries */
2198
2203
 
2199
2204
 
2200
2205
 /*
2206
2211
  httpSetTimeout(http, 30.0, timeout_cb, NULL);
2207
2212
  if (username[0])
2208
2213
    cupsSetUser(username);
2209
 
  cupsSetPasswordCB(password_cb);
 
2214
  cupsSetPasswordCB2((cups_password_cb2_t)password_cb, &password_tries);
2210
2215
 
2211
2216
 /*
2212
2217
  * Loop until the job is canceled, aborted, or completed.
2230
2235
                                                   monitor->resource,
2231
2236
                                                   monitor->user,
2232
2237
                                                   monitor->version);
 
2238
      if (cupsLastError() <= IPP_OK_CONFLICT)
 
2239
        password_tries = 0;
2233
2240
 
2234
2241
     /*
2235
2242
      * Check the status of the job itself...
2698
2705
 */
2699
2706
 
2700
2707
static const char *                     /* O - Password  */
2701
 
password_cb(const char *prompt)         /* I - Prompt (not used) */
 
2708
password_cb(const char *prompt,         /* I - Prompt (not used) */
 
2709
            http_t     *http,           /* I - Connection */
 
2710
            const char *method,         /* I - Request method (not used) */
 
2711
            const char *resource,       /* I - Resource path (not used) */
 
2712
            int        *password_tries) /* I - Password tries */
2702
2713
{
2703
 
  fprintf(stderr, "DEBUG: password_cb(prompt=\"%s\"), password=%p, "
2704
 
          "password_tries=%d\n", prompt, password, password_tries);
 
2714
  fprintf(stderr, "DEBUG: password_cb(prompt=\"%s\", http=%p, method=\"%s\", "
 
2715
                  "resource=\"%s\", password_tries=%p(%d)), password=%p\n",
 
2716
          prompt, http, method, resource, password_tries, *password_tries,
 
2717
          password);
2705
2718
 
2706
2719
  (void)prompt;
 
2720
  (void)method;
 
2721
  (void)resource;
2707
2722
 
2708
2723
 /*
2709
2724
  * Remember that we need to authenticate...
2711
2726
 
2712
2727
  auth_info_required = "username,password";
2713
2728
 
2714
 
  if (password && *password && password_tries < 3)
 
2729
  if (password && *password && *password_tries < 3)
2715
2730
  {
2716
 
    password_tries ++;
 
2731
    (*password_tries) ++;
2717
2732
 
2718
2733
    return (password);
2719
2734
  }
3376
3391
}
3377
3392
 
3378
3393
/*
3379
 
 * End of "$Id: ipp.c 10890 2013-03-08 18:42:09Z mike $".
 
3394
 * End of "$Id: ipp.c 9759 2011-05-11 03:24:33Z mike $".
3380
3395
 */