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

« back to all changes in this revision

Viewing changes to .pc/no-conffile-timestamp.patch/scheduler/job.c

  • Committer: Package Import Robot
  • Author(s): Till Kamppeter
  • Date: 2013-08-23 14:27:01 UTC
  • mfrom: (99.1.25 saucy-proposed)
  • Revision ID: package-import@ubuntu.com-20130823142701-hgvck4nascy3i2q8
* New upstream release
   - Improved support for paid, PIN, and release printing
   - Expanded support for IPP Everywhere
   - Automatic support for data compression
   - Improved CUPS APIs
* debian/patches/usb-backend-do-not-crash-if-usb-disabled-in-bios.patch,
  debian/patches/cupsd-no-crash-on-avahi-threaded-poll-shutdown.patch:
  Removed, applied upstream.
* debian/patches/drop-arch-specifics-from-doc.patch: Removed, not needed
  any more.
* debian/patches/get-ppd-file-for-statically-configured-ipp-shared-queues.patch,
  debian/patches/pidfile.patch,
  debian/patches/rootbackends-worldreadable.patch,
  debian/patches/cups-dbus-utf8.patch,
  debian/patches/airprint-support.patch,
  debian/patches/no-conffile-timestamp.patch,
  debian/patches/read-embedded-options-from-incoming-postscript-and-add-to-ipp-attrs.patch,
  debian/patches/tests-ignore-warnings.patch,
  debian/patches/tests-ignore-usb-crash.patch,
  debian/patches/test-i18n-nonlinux.patch,
  debian/patches/tests-wait-on-unfinished-jobs-everytime.patch,
  debian/patches/tests-fix-ppdLocalize-on-unclean-env.patch,
  debian/patches/tests-use-cupsfilters.patch,
  debian/patches/add-ipp-backend-of-cups-1.4.patch,
  debian/patches/confdirperms.patch,
  debian/patches/show-compile-command-lines.patch,
  debian/patches/ppdc-dynamic-linking.patch,
  debian/patches/log-debug-history-nearly-unlimited.patch:
  Refreshed with quilt.
* debian/patches/ppd-poll-with-client-conf.patch,
  debian/patches/manpage-hyphen-minus.patch,
  debian/patches/drop_unnecessary_dependencies.patch,
  debian/patches/do-not-broadcast-with-hostnames.patch,
  debian/patches/manpage-translations.patch,
  debian/patches/printer-filtering.patch: Updated manually to apply
  to the new CUPS version.
* debian/patches/ippfind-fix-port-output.patch: Fixed output of the port
  number when listing available IPP printer URIs with ippfind.
* debian/patches/tests-ignore-warnings.patch: Added error counting exception
  from usb-backend-do-not-crash-if-usb-disabled-in-bios.patch to this patch.
* debian/patches/ubuntu/ubuntu-tests-skip-number-of-errors.patch:
  Override error_log error message count test.
* debian/patches/tests-skip-ipp.patch,
  debian/patches/ubuntu/ubuntu-tests-skip-ipp.patch: Make the temporary
  test override a Ubuntu-only patch.
* debian/patches/manpage-translations.patch: Temporarily deactivated, po4a
  problem.
* debian/cups-client.install, debian/rules: Install the newly added ippfind
  utility and its man page.
* debian/libcups2-dev.install: Added pwg.h to libcups2-dev package.
* debian/control: Instead of removing the "Recommends: ghostscript-cups"
  use "cups-filters (>= 1.0.36) | ghostscript-cups (>= 9.02~)".
* debian/libcups2.symbols, debian/libcupsppdc1.symbols: Refreshed using the
  diff of the dpkg-gensymbols output during build.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
 
 * "$Id: job.c 7902 2008-09-03 14:20:17Z mike $"
 
2
 * "$Id: job.c 10996 2013-05-29 11:51:34Z msweet $"
3
3
 *
4
4
 *   Job management routines for the CUPS scheduler.
5
5
 *
598
598
 
599
599
  memset(job->filters, 0, sizeof(job->filters));
600
600
 
601
 
 
602
601
  if (job->printer->raw)
603
602
  {
604
603
   /*
941
940
                          IPP_TAG_LANGUAGE);
942
941
 
943
942
#ifdef __APPLE__
944
 
  strcpy(apple_language, "APPLE_LANGUAGE=");
 
943
  strlcpy(apple_language, "APPLE_LANGUAGE=", sizeof(apple_language));
945
944
  _cupsAppleLanguage(attr->values[0].string.text,
946
945
                     apple_language + 15, sizeof(apple_language) - 15);
947
946
#endif /* __APPLE__ */
954
953
        * the POSIX locale...
955
954
        */
956
955
 
957
 
        strcpy(lang, "LANG=C");
 
956
        strlcpy(lang, "LANG=C", sizeof(lang));
958
957
        break;
959
958
 
960
959
    case 2 :
1012
1011
      * All of these strcpy's are safe because we allocated the psr string...
1013
1012
      */
1014
1013
 
1015
 
      strcpy(printer_state_reasons, "PRINTER_STATE_REASONS=");
 
1014
      strlcpy(printer_state_reasons, "PRINTER_STATE_REASONS=", psrlen);
1016
1015
      for (psrptr = printer_state_reasons + 22, i = 0;
1017
1016
           i < job->printer->num_reasons;
1018
1017
           i ++)
1019
1018
      {
1020
1019
        if (i)
1021
1020
          *psrptr++ = ',';
1022
 
        strcpy(psrptr, job->printer->reasons[i]);
 
1021
        strlcpy(psrptr, job->printer->reasons[i],
 
1022
                psrlen - (psrptr - printer_state_reasons));
1023
1023
        psrptr += strlen(psrptr);
1024
1024
      }
1025
1025
    }
1131
1131
  * Now create processes for all of the filters...
1132
1132
  */
1133
1133
 
1134
 
  cupsdSetPrinterReasons(job->printer, "-cups-missing-filter-warning,"
1135
 
                                       "cups-insecure-filter-warning");
1136
 
 
1137
1134
  for (i = 0, slot = 0, filter = (mime_filter_t *)cupsArrayFirst(filters);
1138
1135
       filter;
1139
1136
       i ++, filter = (mime_filter_t *)cupsArrayNext(filters))
1892
1889
                                                 fileid);
1893
1890
        }
1894
1891
 
 
1892
        if (compressions)
 
1893
          job->compressions = compressions;
 
1894
 
 
1895
        if (filetypes)
 
1896
          job->filetypes = filetypes;
 
1897
 
1895
1898
        if (!compressions || !filetypes)
1896
1899
        {
1897
1900
          cupsdLogMessage(CUPSD_LOG_ERROR,
1901
1904
          ippDelete(job->attrs);
1902
1905
          job->attrs = NULL;
1903
1906
 
1904
 
          if (compressions)
1905
 
            free(compressions);
1906
 
 
1907
 
          if (filetypes)
1908
 
            free(filetypes);
1909
 
 
1910
1907
          if (job->compressions)
1911
1908
          {
1912
1909
            free(job->compressions);
1923
1920
          return (0);
1924
1921
        }
1925
1922
 
1926
 
        job->compressions = compressions;
1927
 
        job->filetypes    = filetypes;
1928
 
        job->num_files    = fileid;
 
1923
        job->num_files = fileid;
1929
1924
      }
1930
1925
 
1931
1926
      job->filetypes[fileid - 1] = mimeFileType(MimeDatabase, jobfile, NULL,
3068
3063
        job_state = IPP_JOB_COMPLETED;
3069
3064
        message   = "Job completed.";
3070
3065
 
3071
 
        ippSetString(job->attrs, &job->reasons, 0,
3072
 
                     "job-completed-successfully");
 
3066
        if (!job->status)
 
3067
          ippSetString(job->attrs, &job->reasons, 0,
 
3068
                       "job-completed-successfully");
3073
3069
        break;
3074
3070
 
3075
3071
    case IPP_JOB_STOPPED :
3255
3251
            * Hold the job...
3256
3252
            */
3257
3253
 
3258
 
            cupsdSetJobHoldUntil(job, "indefinite", 1);
3259
 
            ippSetString(job->attrs, &job->reasons, 0,
3260
 
                         "job-hold-until-specified");
3261
 
 
3262
 
            job_state = IPP_JOB_HELD;
3263
 
            message   = "Job held indefinitely due to backend errors; please "
 
3254
            const char *reason = ippGetString(job->reasons, 0, NULL);
 
3255
 
 
3256
            cupsdLogJob(job, CUPSD_LOG_DEBUG, "job-state-reasons=\"%s\"",
 
3257
                        reason);
 
3258
 
 
3259
            if (!reason || strncmp(reason, "account-", 8))
 
3260
            {
 
3261
              cupsdSetJobHoldUntil(job, "indefinite", 1);
 
3262
 
 
3263
              ippSetString(job->attrs, &job->reasons, 0,
 
3264
                           "job-hold-until-specified");
 
3265
              message = "Job held indefinitely due to backend errors; please "
3264
3266
                        "consult the error_log file for details.";
 
3267
            }
 
3268
            else if (!strcmp(reason, "account-info-needed"))
 
3269
            {
 
3270
              cupsdSetJobHoldUntil(job, "indefinite", 0);
 
3271
 
 
3272
              message = "Job held indefinitely - account information is "
 
3273
                        "required.";
 
3274
            }
 
3275
            else if (!strcmp(reason, "account-closed"))
 
3276
            {
 
3277
              cupsdSetJobHoldUntil(job, "indefinite", 0);
 
3278
 
 
3279
              message = "Job held indefinitely - account has been closed.";
 
3280
            }
 
3281
            else if (!strcmp(reason, "account-limit-reached"))
 
3282
            {
 
3283
              cupsdSetJobHoldUntil(job, "indefinite", 0);
 
3284
 
 
3285
              message = "Job held indefinitely - account limit has been "
 
3286
                        "reached.";
 
3287
            }
 
3288
            else
 
3289
            {
 
3290
              cupsdSetJobHoldUntil(job, "indefinite", 0);
 
3291
 
 
3292
              message = "Job held indefinitely - account authorization failed.";
 
3293
            }
 
3294
 
 
3295
            job_state = IPP_JOB_HELD;
3265
3296
          }
3266
3297
          break;
3267
3298
 
3295
3326
            job_state = IPP_JOB_HELD;
3296
3327
            message   = "Job held for authentication.";
3297
3328
 
3298
 
            ippSetString(job->attrs, &job->reasons, 0,
3299
 
                         "cups-held-for-authentication");
 
3329
            if (strncmp(job->reasons->values[0].string.text, "account-", 8))
 
3330
              ippSetString(job->attrs, &job->reasons, 0,
 
3331
                           "cups-held-for-authentication");
3300
3332
          }
3301
3333
          break;
3302
3334
 
3480
3512
                        "com.apple.print.DocumentTicket.PMSpoolFormat",
3481
3513
                        IPP_TAG_ZERO) &&
3482
3514
      !ippFindAttribute(job->attrs, "APPrinterPreset", IPP_TAG_ZERO) &&
3483
 
      (ippFindAttribute(job->attrs, "output-mode", IPP_TAG_ZERO) ||
3484
 
       ippFindAttribute(job->attrs, "print-color-mode", IPP_TAG_ZERO) ||
 
3515
      (ippFindAttribute(job->attrs, "print-color-mode", IPP_TAG_ZERO) ||
3485
3516
       ippFindAttribute(job->attrs, "print-quality", IPP_TAG_ZERO)))
3486
3517
  {
3487
3518
   /*
3488
 
    * Map output-mode and print-quality to a preset...
 
3519
    * Map print-color-mode and print-quality to a preset...
3489
3520
    */
3490
3521
 
3491
3522
    if ((attr = ippFindAttribute(job->attrs, "print-color-mode",
3492
 
                                 IPP_TAG_KEYWORD)) == NULL)
3493
 
      attr = ippFindAttribute(job->attrs, "output-mode", IPP_TAG_KEYWORD);
3494
 
 
3495
 
    if (attr && !strcmp(attr->values[0].string.text, "monochrome"))
 
3523
                                 IPP_TAG_KEYWORD)) != NULL &&
 
3524
        !strcmp(attr->values[0].string.text, "monochrome"))
3496
3525
      print_color_mode = _PWG_PRINT_COLOR_MODE_MONOCHROME;
3497
3526
    else
3498
3527
      print_color_mode = _PWG_PRINT_COLOR_MODE_COLOR;
3679
3708
          attr->value_tag == IPP_TAG_MIMETYPE ||
3680
3709
          attr->value_tag == IPP_TAG_NAMELANG ||
3681
3710
          attr->value_tag == IPP_TAG_TEXTLANG ||
3682
 
          (attr->value_tag == IPP_TAG_URI && strcmp(attr->name, "job-uuid")) ||
 
3711
          (attr->value_tag == IPP_TAG_URI && strcmp(attr->name, "job-uuid") &&
 
3712
           strcmp(attr->name, "job-authorization-uri")) ||
3683
3713
          attr->value_tag == IPP_TAG_URISCHEME ||
3684
3714
          attr->value_tag == IPP_TAG_BEGIN_COLLECTION) /* Not yet supported */
3685
3715
        continue;
3694
3724
        continue;
3695
3725
 
3696
3726
      if (!strncmp(attr->name, "job-", 4) &&
 
3727
          strcmp(attr->name, "job-account-id") &&
 
3728
          strcmp(attr->name, "job-accounting-user-id") &&
 
3729
          strcmp(attr->name, "job-authorization-uri") &&
3697
3730
          strcmp(attr->name, "job-billing") &&
3698
3731
          strcmp(attr->name, "job-impressions") &&
3699
3732
          strcmp(attr->name, "job-originating-host-name") &&
 
3733
          strcmp(attr->name, "job-password") &&
 
3734
          strcmp(attr->name, "job-password-encryption") &&
3700
3735
          strcmp(attr->name, "job-uuid") &&
3701
3736
          !(job->printer->type & CUPS_PRINTER_REMOTE))
3702
3737
        continue;
3803
3838
  for (i = num_pwgppds, pwgppd = pwgppds; i > 0; i --, pwgppd ++)
3804
3839
  {
3805
3840
    *optptr++ = ' ';
3806
 
    strcpy(optptr, pwgppd->name);
 
3841
    strlcpy(optptr, pwgppd->name, optlength - (optptr - options));
3807
3842
    optptr += strlen(optptr);
3808
3843
    *optptr++ = '=';
3809
 
    strcpy(optptr, pwgppd->value);
 
3844
    strlcpy(optptr, pwgppd->value, optlength - (optptr - options));
3810
3845
    optptr += strlen(optptr);
3811
3846
  }
3812
3847
 
4182
4217
                      line, linenum);
4183
4218
  }
4184
4219
 
 
4220
  if (job)
 
4221
  {
 
4222
    cupsdLogMessage(CUPSD_LOG_ERROR,
 
4223
                    "Missing </Job> directive on line %d.", linenum);
 
4224
    cupsdDeleteJob(job, CUPSD_JOB_PURGE);
 
4225
  }
 
4226
 
4185
4227
  cupsFileClose(fp);
4186
4228
}
4187
4229
 
4343
4385
  {
4344
4386
    snprintf(filename, sizeof(filename), "%s/d%05d-%03d", RequestRoot,
4345
4387
             job->id, i);
4346
 
    if (Classification)
4347
 
      cupsdRemoveFile(filename);
4348
 
    else
4349
 
      unlink(filename);
 
4388
    cupsdUnlinkOrRemoveFile(filename);
4350
4389
  }
4351
4390
 
4352
4391
  free(job->filetypes);
4377
4416
 
4378
4417
  snprintf(filename, sizeof(filename), "%s/c%05d", RequestRoot,
4379
4418
           job->id);
4380
 
  if (Classification)
4381
 
    cupsdRemoveFile(filename);
4382
 
  else
4383
 
    unlink(filename);
 
4419
  cupsdUnlinkOrRemoveFile(filename);
4384
4420
 
4385
4421
  LastEvent |= CUPSD_EVENT_PRINTER_STATE_CHANGED;
4386
4422
}
4440
4476
start_job(cupsd_job_t     *job,         /* I - Job ID */
4441
4477
          cupsd_printer_t *printer)     /* I - Printer to print job */
4442
4478
{
 
4479
  const char    *filename;              /* Support filename */
 
4480
 
 
4481
 
4443
4482
  cupsdLogMessage(CUPSD_LOG_DEBUG2, "start_job(job=%p(%d), printer=%p(%s))",
4444
4483
                  job, job->id, printer, printer->name);
4445
4484
 
4494
4533
    job->cancel_time = 0;
4495
4534
 
4496
4535
 /*
 
4536
  * Check for support files...
 
4537
  */
 
4538
 
 
4539
  cupsdSetPrinterReasons(job->printer, "-cups-missing-filter-warning,"
 
4540
                                       "cups-insecure-filter-warning");
 
4541
 
 
4542
  if (printer->pc)
 
4543
  {
 
4544
    for (filename = (const char *)cupsArrayFirst(printer->pc->support_files);
 
4545
         filename;
 
4546
         filename = (const char *)cupsArrayNext(printer->pc->support_files))
 
4547
    {
 
4548
      if (_cupsFileCheck(filename, _CUPS_FILE_CHECK_FILE, !RunUser,
 
4549
                         cupsdLogFCMessage, printer))
 
4550
        break;
 
4551
    }
 
4552
  }
 
4553
 
 
4554
 /*
4497
4555
  * Setup the last exit status and security profiles...
4498
4556
  */
4499
4557
 
4741
4799
        cupsdAddEvent(CUPSD_EVENT_JOB_PROGRESS, job->printer, job,
4742
4800
                      "Printed %d page(s).", job->sheets->values[0].integer);
4743
4801
    }
 
4802
    else if (loglevel == CUPSD_LOG_JOBSTATE)
 
4803
    {
 
4804
     /*
 
4805
      * Support "keyword" to set job-state-reasons to the specified keyword.
 
4806
      * This is sufficient for the current paid printing stuff.
 
4807
      */
 
4808
 
 
4809
      cupsdLogJob(job, CUPSD_LOG_DEBUG, "JOBSTATE: %s", message);
 
4810
 
 
4811
      ippSetString(job->attrs, &job->reasons, 0, message);
 
4812
    }
4744
4813
    else if (loglevel == CUPSD_LOG_STATE)
4745
4814
    {
4746
4815
      cupsdLogJob(job, CUPSD_LOG_DEBUG, "STATE: %s", message);
4781
4850
      cups_option_t     *attrs;         /* Attributes */
4782
4851
      const char        *attr;          /* Attribute */
4783
4852
 
4784
 
 
4785
4853
      cupsdLogJob(job, CUPSD_LOG_DEBUG, "ATTR: %s", message);
4786
4854
 
4787
4855
      num_attrs = cupsParseOptions(message, 0, &attrs);
4788
4856
 
 
4857
      if ((attr = cupsGetOption("auth-info-default", num_attrs,
 
4858
                                attrs)) != NULL)
 
4859
      {
 
4860
        job->printer->num_options = cupsAddOption("auth-info", attr,
 
4861
                                                  job->printer->num_options,
 
4862
                                                  &(job->printer->options));
 
4863
        cupsdSetPrinterAttrs(job->printer);
 
4864
 
 
4865
        cupsdMarkDirty(CUPSD_DIRTY_PRINTERS);
 
4866
      }
 
4867
 
4789
4868
      if ((attr = cupsGetOption("auth-info-required", num_attrs,
4790
4869
                                attrs)) != NULL)
4791
4870
      {
5121
5200
 
5122
5201
 
5123
5202
/*
5124
 
 * End of "$Id: job.c 7902 2008-09-03 14:20:17Z mike $".
 
5203
 * End of "$Id: job.c 10996 2013-05-29 11:51:34Z msweet $".
5125
5204
 */