~ubuntu-branches/ubuntu/oneiric/cups/oneiric-proposed

« back to all changes in this revision

Viewing changes to scheduler/cups-driverd.cxx

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt, Till Kamppeter, Martin Pitt
  • Date: 2011-08-07 12:53:12 UTC
  • mfrom: (1.2.13 upstream)
  • Revision ID: james.westby@ubuntu.com-20110807125312-s323cyb3oqaxaemo
Tags: 1.5.0-1
[ Till Kamppeter ]
* New upstream release
* debian/patches/usb-backend-no-segfault-on-bad-device-id.patch,
  debian/patches/usb-backend-accept-old-usblp-uris.patch,
  debian/patches/use-ps2write-ghostscript-device-for-pdftops-filter.patch:
  Removed, included upstream.
* debian/patches/poppler-based-pdftops-fixes.patch,
  debian/patches/do-not-emit-ps-level-3-with-poppler.patch: Replaced patch
  by a new one only containing the parts which remain after removing the
  parts included upstream.
* debian/patches/pidfile.patch,
  debian/patches/ppd-poll-with-client-conf.patch,
  debian/patches/cups-avahi.patch,
  debian/patches/drop_unnecessary_dependencies.patch,
  debian/patches/do-not-broadcast-with-hostnames.patch,
  debian/patches/ppdc-dynamic-linking.patch,
  debian/patches/pstops-based-workflow-only-for-printing-ps-on-a-ps-printer.patch:
  Manually regenerated to adapt to upstream changes.
* debian/patches/manpage-translations.patch,
  debian/patches/rootbackends-worldreadable.patch,
  debian/patches/no-conffile-timestamp.patch,
  debian/patches/read-embedded-options-from-incoming-postscript-and-add-to-ipp-attrs.patch,
  debian/patches/cups-snmp-oids-device-id-hp-ricoh.patch,
  debian/patches/configure-default-browse-protocols.patch,
  debian/patches/logfiles_adm_readable.patch,
  debian/patches/confdirperms.patch,
  debian/patches/printer-filtering.patch,
  debian/patches/show-compile-command-lines.patch,
  debian/patches/log-debug-history-nearly-unlimited.patch:
  Refreshed using quilt.
* debian/patches/default-ripcache-size-auto.patch: Dropped, as once,
  Ghostscript 9.04 is ignoring the cache size value as it crashes easily
  otherwise (Ghostscript upstream bug #691586) and second, CUPS defaults to
  more reasonable 128 MB (now only used for imagetops).
* debian/patches/support-gzipped-charmaps.patch: Dropped, as the SBCS and
  VBCS character maps are not used any more by CUPS.
* debian/rules: Enable threads in the ./configure command line, as otherwise
  CUPS 1.5.0 does not build at all.
* debian/local/filters/pdf-filters/filter/pdftoijs.cxx,
  debian/local/filters/pdf-filters/filter/pdftoraster.cxx,
  debian/local/filters/pdf-filters/pdftoopvp/pdftoopvp.cxx,
  debian/local/filters/pdf-filters/pdftopdf/pdftopdf.cxx: Under CUPS 1.5.x.
  all programs using the PPD API of CUPS need to explicitly include
  "<cups/ppd.h>". Updated the PDF filter add-on package.
* debian/local/filters/pdf-filters/addtocups: Make the addition of the
  pdftopdf and pdftoopvp directories also work with CUPS 1.5.x.
* debian/local/filters/pdf-filters/addtocups,
  debian/local/filters/pdf-filters/removefromcups: Added a symbolic link
  cups/i18n.h, so that texttopdf builds.
* debian/cups-client.install: Install the new ipptool and its sample
  files and manpages.
* debian/cups-client.install: Commented out lines for dropped man page
  translations: ipptool, lppasswd, client.conf, ipptoolfile, cupsenable,
  lpadmin, lpinfo, cupsreject, cupsdisable, cupsaccept
* debian/cups-common.install, debian/rules: The /usr/share/cups/charmaps
  directory got removed from CUPS.
* debian/libcups2-dev.install: cups/i18n.h got renamed to
  cups/language-private.h. Install this as /usr/include/cups/i18n.h.
* debian/libcups2.symbols, debian/libcupsmime1.symbols: Updated.
* debian/cups.lintian-overrides, debian/cups.postinst, debian/cups.prerm,
  debian/cups.templates, debian/local/apparmor-profile: The "scsi"
  CUPS backend got dropped upstream, removed its treatment from these files.

[ Martin Pitt ]
* Add Serbian (Cyrillic) debconf translations, thanks Zlatan Todoric.
  (Closes: #635105)
* Add Serbian (Latin) debconf translations, thanks Zlatan Todoric.
  (Closes: #635108)
* debian/local/apparmor-profile: Allow access to serial printers on USB
  adapters. (LP: #677432)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
 
 * "$Id: cups-driverd.cxx 9723 2011-04-27 20:28:36Z mike $"
 
2
 * "$Id: cups-driverd.cxx 9816 2011-06-08 21:19:11Z mike $"
3
3
 *
4
 
 *   PPD/driver support for the Common UNIX Printing System (CUPS).
 
4
 *   PPD/driver support for CUPS.
5
5
 *
6
6
 *   This program handles listing and installing static PPD files, PPD files
7
7
 *   created from driver information files, and dynamically generated PPD files
8
8
 *   using driver helper programs.
9
9
 *
10
 
 *   Copyright 2007-2009 by Apple Inc.
 
10
 *   Copyright 2007-2011 by Apple Inc.
11
11
 *   Copyright 1997-2007 by Easy Software Products.
12
12
 *
13
13
 *   These coded instructions, statements, and computer programs are the
735
735
  * First compare manufacturers...
736
736
  */
737
737
 
738
 
  if ((diff = strcasecmp(p0->record.make, p1->record.make)) != 0)
 
738
  if ((diff = _cups_strcasecmp(p0->record.make, p1->record.make)) != 0)
739
739
    return (diff);
740
740
  else if ((diff = cupsdCompareNames(p0->record.make_and_model,
741
741
                                     p1->record.make_and_model)) != 0)
742
742
    return (diff);
 
743
  else if ((diff = strcmp(p0->record.languages[0],
 
744
                          p1->record.languages[0])) != 0)
 
745
    return (diff);
743
746
  else
744
 
    return (strcmp(p0->record.languages[0], p1->record.languages[0]));
 
747
    return (compare_names(p0, p1));
745
748
}
746
749
 
747
750
 
1150
1153
          }
1151
1154
      }
1152
1155
 
1153
 
      if (make && !strcasecmp(ppd->record.make, make))
 
1156
      if (make && !_cups_strcasecmp(ppd->record.make, make))
1154
1157
        ppd->matches ++;
1155
1158
 
1156
1159
      if (make_and_model_re &&
1178
1181
        for (i = 0; i < PPD_MAX_PROD; i ++)
1179
1182
          if (!ppd->record.products[i][0])
1180
1183
            break;
1181
 
          else if (!strcasecmp(ppd->record.products[i], product))
 
1184
          else if (!_cups_strcasecmp(ppd->record.products[i], product))
1182
1185
          {
1183
1186
            ppd->matches += 3;
1184
1187
            break;
1190
1193
        for (i = 0; i < PPD_MAX_VERS; i ++)
1191
1194
          if (!ppd->record.psversions[i][0])
1192
1195
            break;
1193
 
          else if (!strcasecmp(ppd->record.psversions[i], psversion))
 
1196
          else if (!_cups_strcasecmp(ppd->record.psversions[i], psversion))
1194
1197
          {
1195
1198
            ppd->matches ++;
1196
1199
            break;
1332
1335
               ppd = (ppd_info_t *)cupsArrayNext(matches);
1333
1336
           ppd;
1334
1337
           ppd = (ppd_info_t *)cupsArrayNext(matches))
1335
 
        if (strcasecmp(this_make, ppd->record.make))
 
1338
        if (_cups_strcasecmp(this_make, ppd->record.make))
1336
1339
          break;
1337
1340
 
1338
1341
      cupsArrayPrev(matches);
1398
1401
  * Add a dummy entry for the file...
1399
1402
  */
1400
1403
 
1401
 
  add_ppd(name, name, "", "", "", "", "", "", mtime, size, 0,
 
1404
  httpAssembleURIf(HTTP_URI_CODING_ALL, uri, sizeof(uri), "drv", "", "", 0,
 
1405
                   "/%s", name);
 
1406
  add_ppd(name, uri, "", "", "", "", "", "", mtime, size, 0,
1402
1407
          PPD_TYPE_DRV, "drv");
1403
1408
  ChangedPPD = 1;
1404
1409
 
1421
1426
 
1422
1427
    if (nick_name)
1423
1428
      strlcpy(make_model, nick_name->value->value, sizeof(make_model));
1424
 
    else if (strncasecmp(d->model_name->value, d->manufacturer->value,
 
1429
    else if (_cups_strncasecmp(d->model_name->value, d->manufacturer->value,
1425
1430
                         strlen(d->manufacturer->value)))
1426
1431
      snprintf(make_model, sizeof(make_model), "%s %s, %s",
1427
1432
               d->manufacturer->value, d->model_name->value,
1431
1436
               d->version->value);
1432
1437
 
1433
1438
    if ((cups_fax = d->find_attr("cupsFax", NULL)) != NULL &&
1434
 
        !strcasecmp(cups_fax->value->value, "true"))
 
1439
        !_cups_strcasecmp(cups_fax->value->value, "true"))
1435
1440
      type = PPD_TYPE_FAX;
1436
1441
    else if (d->type == PPDC_DRIVER_PS)
1437
1442
      type = PPD_TYPE_POSTSCRIPT;
1443
1448
               type = PPD_TYPE_POSTSCRIPT;
1444
1449
           filter;
1445
1450
           filter = (ppdcFilter *)d->filters->next())
1446
 
        if (strcasecmp(filter->mime_type->value, "application/vnd.cups-raster"))
 
1451
        if (_cups_strcasecmp(filter->mime_type->value, "application/vnd.cups-raster"))
1447
1452
          type = PPD_TYPE_RASTER;
1448
 
        else if (strcasecmp(filter->mime_type->value,
 
1453
        else if (_cups_strcasecmp(filter->mime_type->value,
1449
1454
                            "application/vnd.cups-pdf"))
1450
1455
          type = PPD_TYPE_PDF;
1451
1456
    }
1616
1621
    * Run the driver with no arguments and collect the output...
1617
1622
    */
1618
1623
 
 
1624
    snprintf(filename, sizeof(filename), "%s/%s", drivers, dent->filename);
 
1625
 
 
1626
    if (_cupsFileCheck(filename, _CUPS_FILE_CHECK_PROGRAM, !geteuid(),
 
1627
                       _cupsFileCheckFilter, NULL))
 
1628
      continue;
 
1629
 
1619
1630
    argv[0] = dent->filename;
1620
 
    snprintf(filename, sizeof(filename), "%s/%s", drivers, dent->filename);
1621
1631
 
1622
1632
    if ((fp = cupsdPipeCommand(&pid, filename, argv, 0)) != NULL)
1623
1633
    {
1817
1827
  memcpy(dinfoptr, &dinfo, sizeof(struct stat));
1818
1828
  cupsArrayAdd(Inodes, dinfoptr);
1819
1829
 
 
1830
 /*
 
1831
  * Check permissions...
 
1832
  */
 
1833
 
 
1834
  if (_cupsFileCheck(d, _CUPS_FILE_CHECK_DIRECTORY, !geteuid(),
 
1835
                     _cupsFileCheckFilter, NULL))
 
1836
    return (0);
 
1837
 
1820
1838
  if ((dir = cupsDirOpen(d)) == NULL)
1821
1839
  {
1822
1840
    if (errno != ENOENT)
1870
1888
        * Load PPDs in a printer driver bundle.
1871
1889
        */
1872
1890
 
 
1891
        if (_cupsFileCheck(filename, _CUPS_FILE_CHECK_DIRECTORY, !geteuid(),
 
1892
                           _cupsFileCheckFilter, NULL))
 
1893
          continue;
 
1894
 
1873
1895
        strlcat(filename, "/Contents/Resources/PPDs", sizeof(filename));
1874
1896
        strlcat(name, "/Contents/Resources/PPDs", sizeof(name));
1875
1897
 
1887
1909
 
1888
1910
      continue;
1889
1911
    }
 
1912
    else if (_cupsFileCheck(filename, _CUPS_FILE_CHECK_FILE_ONLY, !geteuid(),
 
1913
                            _cupsFileCheckFilter, NULL))
 
1914
      continue;
1890
1915
 
1891
1916
   /*
1892
1917
    * See if this file has been scanned before...
1973
1998
        sscanf(line, "%*[^:]:%63s", lang_version);
1974
1999
      else if (!strncmp(line, "*NickName:", 10))
1975
2000
        sscanf(line, "%*[^\"]\"%255[^\"]", nick_name);
1976
 
      else if (!strncasecmp(line, "*1284DeviceID:", 14))
 
2001
      else if (!_cups_strncasecmp(line, "*1284DeviceID:", 14))
1977
2002
      {
1978
2003
        sscanf(line, "%*[^\"]\"%255[^\"]", device_id);
1979
2004
 
2041
2066
      {
2042
2067
        for (ptr = line + 9; isspace(*ptr & 255); ptr ++);
2043
2068
 
2044
 
        if (!strncasecmp(ptr, "true", 4))
 
2069
        if (!_cups_strncasecmp(ptr, "true", 4))
2045
2070
          type = PPD_TYPE_FAX;
2046
2071
      }
2047
2072
      else if (!strncmp(line, "*cupsFilter:", 12) && type == PPD_TYPE_POSTSCRIPT)
2119
2144
    while (isspace(manufacturer[0] & 255))
2120
2145
      _cups_strcpy(manufacturer, manufacturer + 1);
2121
2146
 
2122
 
    if (!strncasecmp(make_model, manufacturer, strlen(manufacturer)))
 
2147
    if (!_cups_strncasecmp(make_model, manufacturer, strlen(manufacturer)))
2123
2148
      strlcpy(temp, make_model, sizeof(temp));
2124
2149
    else
2125
2150
      snprintf(temp, sizeof(temp), "%s %s", manufacturer, make_model);
2152
2177
      else
2153
2178
        strcpy(manufacturer, "Other");
2154
2179
    }
2155
 
    else if (!strncasecmp(manufacturer, "LHAG", 4) ||
2156
 
             !strncasecmp(manufacturer, "linotype", 8))
 
2180
    else if (!_cups_strncasecmp(manufacturer, "LHAG", 4) ||
 
2181
             !_cups_strncasecmp(manufacturer, "linotype", 8))
2157
2182
      strcpy(manufacturer, "LHAG");
2158
 
    else if (!strncasecmp(manufacturer, "Hewlett", 7))
 
2183
    else if (!_cups_strncasecmp(manufacturer, "Hewlett", 7))
2159
2184
      strcpy(manufacturer, "HP");
2160
2185
 
2161
2186
   /*
2186
2211
    }
2187
2212
 
2188
2213
    for (i = 0; i < (int)(sizeof(languages) / sizeof(languages[0])); i ++)
2189
 
      if (!strcasecmp(languages[i].version, lang_version))
 
2214
      if (!_cups_strcasecmp(languages[i].version, lang_version))
2190
2215
        break;
2191
2216
 
2192
2217
    if (i < (int)(sizeof(languages) / sizeof(languages[0])))
2404
2429
 
2405
2430
  while (*device_id && ptr < (res + sizeof(res) - 6))
2406
2431
  {
2407
 
    cmd = !strncasecmp(device_id, "COMMAND SET:", 12) ||
2408
 
          !strncasecmp(device_id, "CMD:", 4);
 
2432
    cmd = !_cups_strncasecmp(device_id, "COMMAND SET:", 12) ||
 
2433
          !_cups_strncasecmp(device_id, "CMD:", 4);
2409
2434
 
2410
 
    if (cmd || !strncasecmp(device_id, "MANUFACTURER:", 13) ||
2411
 
        !strncasecmp(device_id, "MFG:", 4) ||
2412
 
        !strncasecmp(device_id, "MFR:", 4) ||
2413
 
        !strncasecmp(device_id, "MODEL:", 6) ||
2414
 
        !strncasecmp(device_id, "MDL:", 4))
 
2435
    if (cmd || !_cups_strncasecmp(device_id, "MANUFACTURER:", 13) ||
 
2436
        !_cups_strncasecmp(device_id, "MFG:", 4) ||
 
2437
        !_cups_strncasecmp(device_id, "MFR:", 4) ||
 
2438
        !_cups_strncasecmp(device_id, "MODEL:", 6) ||
 
2439
        !_cups_strncasecmp(device_id, "MDL:", 4))
2415
2440
    {
2416
2441
      if (ptr > res)
2417
2442
      {
2421
2446
 
2422
2447
      *ptr++ = '(';
2423
2448
 
2424
 
      while (*device_id && *device_id != ';' && ptr < (res + sizeof(res) - 4))
 
2449
      while (*device_id && *device_id != ';' && ptr < (res + sizeof(res) - 8))
2425
2450
      {
2426
2451
        if (strchr("[]{}().*\\|", *device_id))
2427
2452
          *ptr++ = '\\';
2428
 
        *ptr++ = *device_id++;
 
2453
        if (*device_id == ':')
 
2454
        {
 
2455
         /*
 
2456
          * KEY:.*value
 
2457
          */
 
2458
 
 
2459
          *ptr++ = *device_id++;
 
2460
          *ptr++ = '.';
 
2461
          *ptr++ = '*';
 
2462
        }
 
2463
        else
 
2464
          *ptr++ = *device_id++;
2429
2465
      }
2430
2466
 
2431
2467
      if (*device_id == ';' || !*device_id)
 
2468
      {
 
2469
       /*
 
2470
        * KEY:.*value.*;
 
2471
        */
 
2472
 
 
2473
        *ptr++ = '.';
 
2474
        *ptr++ = '*';
2432
2475
        *ptr++ = ';';
 
2476
      }
2433
2477
      *ptr++ = ')';
2434
2478
      if (cmd)
2435
2479
        *ptr++ = '?';
2516
2560
 
2517
2561
 
2518
2562
/*
2519
 
 * End of "$Id: cups-driverd.cxx 9723 2011-04-27 20:28:36Z mike $".
 
2563
 * End of "$Id: cups-driverd.cxx 9816 2011-06-08 21:19:11Z mike $".
2520
2564
 */