~ubuntu-branches/ubuntu/utopic/cups/utopic

« back to all changes in this revision

Viewing changes to .pc/get-ppd-file-for-statically-configured-ipp-shared-queues.patch/cups/util.c

  • Committer: Package Import Robot
  • Author(s): Didier Raboud, Till Kamppeter, Steve Langasek, Didier Raboud
  • Date: 2014-01-03 18:42:39 UTC
  • mfrom: (1.3.2)
  • mto: This revision was merged to the branch mainline in revision 142.
  • Revision ID: package-import@ubuntu.com-20140103184239-juzq32ckr7ra49b3
* New 1.7.0 upstream release

[ Till Kamppeter ]
* Refresh most patches with quilt
* Removed usb-backend-do-not-crash-if-usb-disabled-in-bios and
  cupsd-no-crash-on-avahi-threaded-poll-shutdown patches as they got
  applied upstream
* Removed drop-arch-specifics-from-doc patch as it is not needed
  anymore
* Updated drop_unnecessary_dependencies, manpage-hyphen-minus,
  manpage-translations and ppd-poll-with-client-conf patches manually
  to apply to the new CUPS version
* Added error counting exception from
  usb-backend-do-not-crash-if-usb-disabled-in-bios to
  tests-ignore-warnings
* Install the newly added ippfind utility and its manpage in
  cups-client
* Added pwg.h to libcups2-dev package
* Call dh_auto_clean only if the file Makedefs is present, to avoid a
  FTBFS
* Added color management extensions from Joe Simon's GSoC 2013
  project.
* Patch cups-files.conf to activate CUPS daemon syncing of files when
  closing, so that config files (like printers.conf) do not
  mysteriously disappear (LP: #1157972)
* In the AppArmor profile, allow execution of programs in
  /etc/cups/interfaces/, needed to make CUPS working with queues based
  on System V interface scripts, especially PPD-less queues
  auto-generated by cups-browsed from cups-filters 1.0.41 on.
* Silenced AppArmor noise from udev.conf in syslog (LP: #1229766)

[ Steve Langasek ]
* Add cups-filters (>= 1.0.42) as alternative to foomatic-filters
  (which is deprecated) in package relationships

[ Didier Raboud ]
* Remove Roger Leigh from uploaders on his request with thanks for his
  past work!
* Switch avahi LSB Should-Start dependency to be avahi-daemon; also
  bump package relationship to >= 0.6.31-3~ (Closes: #731608)
* Refresh the manpage translation files
* Move the USB backend quirk rules file to cups-server-common
* Add 38 new 1.7.0 libcups2 symbols
* Mark one C++ libcupsppdc1 symbol as optional as it isn't exported in
  1.7.0 anymore
* Import Fedora patches:
  - to avoid sign-extending CRCs in gz decompression
  - to build with full read-only relocations
  - to fix job history logging (upstream patch)
  - to set the internal default for SyncOnClose to Yes, instead of
    only configuring it to Yes
  - to fix a stringpool corruption issue
  - to prevent USB timeouts causing incorrect print output
* Import Fedora patch updates:
  - to dont-use-dbus-from-two-threads patch so it removes a call to
    avahi_threaded_poll_stop()
  - to avoid_stale_lockfile_in_dbus_notifier patch to call _exit when
    handling SIGTERM
* Move manpage-translations patch at the very end of the patch series
  to have it include all our patches

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
 
 * "$Id: util.c 11173 2013-07-23 12:31:34Z msweet $"
 
2
 * "$Id: util.c 10996 2013-05-29 11:51:34Z msweet $"
3
3
 *
4
4
 *   Printing utilities for CUPS.
5
5
 *
6
 
 *   Copyright 2007-2012 by Apple Inc.
 
6
 *   Copyright 2007-2013 by Apple Inc.
7
7
 *   Copyright 1997-2006 by Easy Software Products.
8
8
 *
9
9
 *   These coded instructions, statements, and computer programs are the
90
90
              int        job_id)        /* I - Job ID, @code CUPS_JOBID_CURRENT@ for the current job, or @code CUPS_JOBID_ALL@ for all jobs */
91
91
{
92
92
  return (cupsCancelJob2(CUPS_HTTP_DEFAULT, name, job_id, 0)
93
 
              < IPP_REDIRECTION_OTHER_SITE);
 
93
              < IPP_STATUS_REDIRECTION_OTHER_SITE);
94
94
}
95
95
 
96
96
 
125
125
 
126
126
  if (job_id < -1 || (!name && job_id == 0))
127
127
  {
128
 
    _cupsSetError(IPP_INTERNAL_ERROR, strerror(EINVAL), 0);
 
128
    _cupsSetError(IPP_STATUS_ERROR_INTERNAL, strerror(EINVAL), 0);
129
129
    return (0);
130
130
  }
131
131
 
135
135
 
136
136
  if (!http)
137
137
    if ((http = _cupsConnect()) == NULL)
138
 
      return (IPP_SERVICE_UNAVAILABLE);
 
138
      return (IPP_STATUS_ERROR_SERVICE_UNAVAILABLE);
139
139
 
140
140
 /*
141
141
  * Build an IPP_CANCEL_JOB or IPP_PURGE_JOBS request, which requires the following
148
148
  *    [purge-job] or [purge-jobs]
149
149
  */
150
150
 
151
 
  request = ippNewRequest(job_id < 0 ? IPP_PURGE_JOBS : IPP_CANCEL_JOB);
 
151
  request = ippNewRequest(job_id < 0 ? IPP_OP_PURGE_JOBS : IPP_OP_CANCEL_JOB);
152
152
 
153
153
  if (name)
154
154
  {
223
223
 
224
224
  if (!name)
225
225
  {
226
 
    _cupsSetError(IPP_INTERNAL_ERROR, strerror(EINVAL), 0);
 
226
    _cupsSetError(IPP_STATUS_ERROR_INTERNAL, strerror(EINVAL), 0);
227
227
    return (0);
228
228
  }
229
229
 
231
231
  * Build a Create-Job request...
232
232
  */
233
233
 
234
 
  if ((request = ippNewRequest(IPP_CREATE_JOB)) == NULL)
 
234
  if ((request = ippNewRequest(IPP_OP_CREATE_JOB)) == NULL)
235
235
  {
236
 
    _cupsSetError(IPP_INTERNAL_ERROR, strerror(ENOMEM), 0);
 
236
    _cupsSetError(IPP_STATUS_ERROR_INTERNAL, strerror(ENOMEM), 0);
237
237
    return (0);
238
238
  }
239
239
 
248
248
  if (title)
249
249
    ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "job-name", NULL,
250
250
                 title);
 
251
  cupsEncodeOptions2(request, num_options, options, IPP_TAG_OPERATION);
251
252
  cupsEncodeOptions2(request, num_options, options, IPP_TAG_JOB);
252
253
  cupsEncodeOptions2(request, num_options, options, IPP_TAG_SUBSCRIPTION);
253
254
 
341
342
 
342
343
  if (!classes)
343
344
  {
344
 
    _cupsSetError(IPP_INTERNAL_ERROR, strerror(EINVAL), 0);
 
345
    _cupsSetError(IPP_STATUS_ERROR_INTERNAL, strerror(EINVAL), 0);
345
346
 
346
347
    return (0);
347
348
  }
360
361
  *    requested-attributes
361
362
  */
362
363
 
363
 
  request = ippNewRequest(CUPS_GET_CLASSES);
 
364
  request = ippNewRequest(IPP_OP_CUPS_GET_CLASSES);
364
365
 
365
366
  ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD,
366
367
               "requested-attributes", NULL, "printer-name");
479
480
  *    attributes-natural-language
480
481
  */
481
482
 
482
 
  request = ippNewRequest(CUPS_GET_DEFAULT);
 
483
  request = ippNewRequest(IPP_OP_CUPS_GET_DEFAULT);
483
484
 
484
485
 /*
485
486
  * Do the request and get back a response...
585
586
 
586
587
  if (!jobs)
587
588
  {
588
 
    _cupsSetError(IPP_INTERNAL_ERROR, strerror(EINVAL), 0);
 
589
    _cupsSetError(IPP_STATUS_ERROR_INTERNAL, strerror(EINVAL), 0);
589
590
 
590
591
    return (-1);
591
592
  }
597
598
  if (name)
598
599
  {
599
600
    if (httpAssembleURIf(HTTP_URI_CODING_ALL, uri, sizeof(uri), "ipp", NULL,
600
 
                         "localhost", 0, "/printers/%s", name) != HTTP_URI_OK)
 
601
                         "localhost", 0, "/printers/%s",
 
602
                         name) < HTTP_URI_STATUS_OK)
601
603
    {
602
 
      _cupsSetError(IPP_INTERNAL_ERROR, _("Unable to create printer-uri"), 1);
 
604
      _cupsSetError(IPP_STATUS_ERROR_INTERNAL,
 
605
                    _("Unable to create printer-uri"), 1);
603
606
 
604
607
      return (-1);
605
608
    }
606
609
  }
607
610
  else
608
 
    strcpy(uri, "ipp://localhost/");
 
611
    strlcpy(uri, "ipp://localhost/", sizeof(uri));
609
612
 
610
613
  if (!http)
611
614
    if ((http = _cupsConnect()) == NULL)
624
627
  *    requested-attributes
625
628
  */
626
629
 
627
 
  request = ippNewRequest(IPP_GET_JOBS);
 
630
  request = ippNewRequest(IPP_OP_GET_JOBS);
628
631
 
629
632
  ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI,
630
633
               "printer-uri", NULL, uri);
674
677
      id              = 0;
675
678
      size            = 0;
676
679
      priority        = 50;
677
 
      state           = IPP_JOB_PENDING;
 
680
      state           = IPP_JSTATE_PENDING;
678
681
      user            = "unknown";
679
682
      dest            = NULL;
680
683
      format          = "application/octet-stream";
753
756
        * Ran out of memory!
754
757
        */
755
758
 
756
 
        _cupsSetError(IPP_INTERNAL_ERROR, NULL, 0);
 
759
        _cupsSetError(IPP_STATUS_ERROR_INTERNAL, NULL, 0);
757
760
 
758
761
        cupsFreeJobs(n, *jobs);
759
762
        *jobs = NULL;
790
793
    ippDelete(response);
791
794
  }
792
795
 
793
 
  if (n == 0 && cg->last_error >= IPP_BAD_REQUEST)
 
796
  if (n == 0 && cg->last_error >= IPP_STATUS_ERROR_BAD_REQUEST)
794
797
    return (-1);
795
798
  else
796
799
    return (n);
822
825
  cg->ppd_filename[0] = '\0';
823
826
 
824
827
  if (cupsGetPPD3(CUPS_HTTP_DEFAULT, name, &modtime, cg->ppd_filename,
825
 
                  sizeof(cg->ppd_filename)) == HTTP_OK)
 
828
                  sizeof(cg->ppd_filename)) == HTTP_STATUS_OK)
826
829
    return (cg->ppd_filename);
827
830
  else
828
831
    return (NULL);
853
856
  cg->ppd_filename[0] = '\0';
854
857
 
855
858
  if (cupsGetPPD3(http, name, &modtime, cg->ppd_filename,
856
 
                  sizeof(cg->ppd_filename)) == HTTP_OK)
 
859
                  sizeof(cg->ppd_filename)) == HTTP_STATUS_OK)
857
860
    return (cg->ppd_filename);
858
861
  else
859
862
    return (NULL);
873
876
 * file will be overwritten as needed.  The caller "owns" the file that is
874
877
 * created and must @code unlink@ the returned filename.
875
878
 *
876
 
 * On success, @code HTTP_OK@ is returned for a new PPD file and
877
 
 * @code HTTP_NOT_MODIFIED@ if the existing PPD file is up-to-date.  Any other
 
879
 * On success, @code HTTP_STATUS_OK@ is returned for a new PPD file and
 
880
 * @code HTTP_STATUS_NOT_MODIFIED@ if the existing PPD file is up-to-date.  Any other
878
881
 * status is an error.
879
882
 *
880
883
 * For classes, @code cupsGetPPD3@ returns the PPD file for the first printer
914
917
 
915
918
  if (!name)
916
919
  {
917
 
    _cupsSetError(IPP_INTERNAL_ERROR, _("No printer name"), 1);
918
 
    return (HTTP_NOT_ACCEPTABLE);
 
920
    _cupsSetError(IPP_STATUS_ERROR_INTERNAL, _("No printer name"), 1);
 
921
    return (HTTP_STATUS_NOT_ACCEPTABLE);
919
922
  }
920
923
 
921
924
  if (!modtime)
922
925
  {
923
 
    _cupsSetError(IPP_INTERNAL_ERROR, _("No modification time"), 1);
924
 
    return (HTTP_NOT_ACCEPTABLE);
 
926
    _cupsSetError(IPP_STATUS_ERROR_INTERNAL, _("No modification time"), 1);
 
927
    return (HTTP_STATUS_NOT_ACCEPTABLE);
925
928
  }
926
929
 
927
930
  if (!buffer || bufsize <= 1)
928
931
  {
929
 
    _cupsSetError(IPP_INTERNAL_ERROR, _("Bad filename buffer"), 1);
930
 
    return (HTTP_NOT_ACCEPTABLE);
 
932
    _cupsSetError(IPP_STATUS_ERROR_INTERNAL, _("Bad filename buffer"), 1);
 
933
    return (HTTP_STATUS_NOT_ACCEPTABLE);
931
934
  }
932
935
 
933
936
#ifndef WIN32
964
967
 
965
968
        if (symlink(ppdname, buffer) && errno != EEXIST)
966
969
        {
967
 
          _cupsSetError(IPP_INTERNAL_ERROR, NULL, 0);
 
970
          _cupsSetError(IPP_STATUS_ERROR_INTERNAL, NULL, 0);
968
971
 
969
 
          return (HTTP_SERVER_ERROR);
 
972
          return (HTTP_STATUS_SERVER_ERROR);
970
973
        }
971
974
      }
972
975
      else
1024
1027
 
1025
1028
        if (tries >= 1000)
1026
1029
        {
1027
 
          _cupsSetError(IPP_INTERNAL_ERROR, NULL, 0);
 
1030
          _cupsSetError(IPP_STATUS_ERROR_INTERNAL, NULL, 0);
1028
1031
 
1029
 
          return (HTTP_SERVER_ERROR);
 
1032
          return (HTTP_STATUS_SERVER_ERROR);
1030
1033
        }
1031
1034
      }
1032
1035
 
1033
1036
      if (*modtime >= ppdinfo.st_mtime)
1034
 
        return (HTTP_NOT_MODIFIED);
 
1037
        return (HTTP_STATUS_NOT_MODIFIED);
1035
1038
      else
1036
1039
      {
1037
1040
        *modtime = ppdinfo.st_mtime;
1038
 
        return (HTTP_OK);
 
1041
        return (HTTP_STATUS_OK);
1039
1042
      }
1040
1043
    }
1041
1044
  }
1047
1050
 
1048
1051
  if (!http)
1049
1052
    if ((http = _cupsConnect()) == NULL)
1050
 
      return (HTTP_SERVICE_UNAVAILABLE);
 
1053
      return (HTTP_STATUS_SERVICE_UNAVAILABLE);
1051
1054
 
1052
1055
  if (!cups_get_printer_uri(http, name, hostname, sizeof(hostname), &port,
1053
1056
                            resource, sizeof(resource), 0))
1054
 
    return (HTTP_NOT_FOUND);
 
1057
    return (HTTP_STATUS_NOT_FOUND);
1055
1058
 
1056
1059
  DEBUG_printf(("2cupsGetPPD3: Printer hostname=\"%s\", port=%d", hostname,
1057
1060
                port));
1065
1068
  DEBUG_printf(("2cupsGetPPD3: Local hostname=\"%s\"", localhost));
1066
1069
 
1067
1070
  if (!_cups_strcasecmp(localhost, hostname))
1068
 
    strcpy(hostname, "localhost");
 
1071
    strlcpy(hostname, "localhost", sizeof(hostname));
1069
1072
 
1070
1073
 /*
1071
1074
  * Get the hostname and port number we are connected to...
1072
1075
  */
1073
1076
 
1074
1077
  httpGetHostname(http, http_hostname, sizeof(http_hostname));
1075
 
  http_port = _httpAddrPort(http->hostaddr);
 
1078
  http_port = httpAddrPort(http->hostaddr);
1076
1079
 
1077
1080
  DEBUG_printf(("2cupsGetPPD3: Connection hostname=\"%s\", port=%d",
1078
1081
                http_hostname, http_port));
1083
1086
 
1084
1087
  if (!_cups_strcasecmp(http_hostname, hostname) && port == http_port)
1085
1088
    http2 = http;
1086
 
  else if ((http2 = httpConnectEncrypt(hostname, port,
1087
 
                                       cupsEncryption())) == NULL)
 
1089
  else if ((http2 = httpConnect2(hostname, port, NULL, AF_UNSPEC,
 
1090
                                 cupsEncryption(), 1, 30000, NULL)) == NULL)
1088
1091
  {
1089
1092
    DEBUG_puts("1cupsGetPPD3: Unable to connect to server");
1090
1093
 
1091
 
    return (HTTP_SERVICE_UNAVAILABLE);
 
1094
    return (HTTP_STATUS_SERVICE_UNAVAILABLE);
1092
1095
  }
1093
1096
 
1094
1097
 /*
1106
1109
    * Can't open file; close the server connection and return NULL...
1107
1110
    */
1108
1111
 
1109
 
    _cupsSetError(IPP_INTERNAL_ERROR, NULL, 0);
 
1112
    _cupsSetError(IPP_STATUS_ERROR_INTERNAL, NULL, 0);
1110
1113
 
1111
1114
    if (http2 != http)
1112
1115
      httpClose(http2);
1113
1116
 
1114
 
    return (HTTP_SERVER_ERROR);
 
1117
    return (HTTP_STATUS_SERVER_ERROR);
1115
1118
  }
1116
1119
 
1117
1120
 /*
1132
1135
  * See if we actually got the file or an error...
1133
1136
  */
1134
1137
 
1135
 
  if (status == HTTP_OK)
 
1138
  if (status == HTTP_STATUS_OK)
1136
1139
  {
1137
1140
    *modtime = httpGetDateTime(httpGetField(http2, HTTP_FIELD_DATE));
1138
1141
 
1139
1142
    if (tempfile[0])
1140
1143
      strlcpy(buffer, tempfile, bufsize);
1141
1144
  }
1142
 
  else if (status != HTTP_NOT_MODIFIED)
 
1145
  else if (status != HTTP_STATUS_NOT_MODIFIED)
1143
1146
  {
1144
1147
    _cupsSetHTTPError(status);
1145
1148
 
1189
1192
 
1190
1193
  if (!printers)
1191
1194
  {
1192
 
    _cupsSetError(IPP_INTERNAL_ERROR, strerror(EINVAL), 0);
 
1195
    _cupsSetError(IPP_STATUS_ERROR_INTERNAL, strerror(EINVAL), 0);
1193
1196
 
1194
1197
    return (0);
1195
1198
  }
1212
1215
  *    requested-attributes
1213
1216
  */
1214
1217
 
1215
 
  request = ippNewRequest(CUPS_GET_PRINTERS);
 
1218
  request = ippNewRequest(IPP_OP_CUPS_GET_PRINTERS);
1216
1219
 
1217
1220
  ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD,
1218
1221
               "requested-attributes", NULL, "printer-name");
1301
1304
 
1302
1305
  if (!name)
1303
1306
  {
1304
 
    _cupsSetError(IPP_INTERNAL_ERROR, _("No PPD name"), 1);
 
1307
    _cupsSetError(IPP_STATUS_ERROR_INTERNAL, _("No PPD name"), 1);
1305
1308
 
1306
1309
    return (NULL);
1307
1310
  }
1320
1323
    * Can't open file; close the server connection and return NULL...
1321
1324
    */
1322
1325
 
1323
 
    _cupsSetError(IPP_INTERNAL_ERROR, NULL, 0);
 
1326
    _cupsSetError(IPP_STATUS_ERROR_INTERNAL, NULL, 0);
1324
1327
 
1325
1328
    return (NULL);
1326
1329
  }
1329
1332
  * Get the PPD file...
1330
1333
  */
1331
1334
 
1332
 
  request = ippNewRequest(CUPS_GET_PPD);
 
1335
  request = ippNewRequest(IPP_OP_CUPS_GET_PPD);
1333
1336
  ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "ppd-name", NULL,
1334
1337
               name);
1335
1338
 
1337
1340
 
1338
1341
  close(fd);
1339
1342
 
1340
 
  if (cupsLastError() != IPP_OK)
 
1343
  if (cupsLastError() != IPP_STATUS_OK)
1341
1344
  {
1342
1345
    unlink(cg->ppd_filename);
1343
1346
    return (NULL);
1459
1462
 
1460
1463
  if (!name || num_files < 1 || !files)
1461
1464
  {
1462
 
    _cupsSetError(IPP_INTERNAL_ERROR, strerror(EINVAL), 0);
 
1465
    _cupsSetError(IPP_STATUS_ERROR_INTERNAL, strerror(EINVAL), 0);
1463
1466
 
1464
1467
    return (0);
1465
1468
  }
1498
1501
      * Unable to open print file, cancel the job and return...
1499
1502
      */
1500
1503
 
1501
 
      _cupsSetError(IPP_DOCUMENT_ACCESS_ERROR, NULL, 0);
 
1504
      _cupsSetError(IPP_STATUS_ERROR_DOCUMENT_ACCESS, NULL, 0);
1502
1505
      goto cancel_job;
1503
1506
    }
1504
1507
 
1505
1508
    status = cupsStartDocument(http, name, job_id, docname, format,
1506
1509
                               i == (num_files - 1));
1507
1510
 
1508
 
    while (status == HTTP_CONTINUE &&
 
1511
    while (status == HTTP_STATUS_CONTINUE &&
1509
1512
           (bytes = cupsFileRead(fp, buffer, sizeof(buffer))) > 0)
1510
1513
      status = cupsWriteRequestData(http, buffer, bytes);
1511
1514
 
1512
1515
    cupsFileClose(fp);
1513
1516
 
1514
 
    if (status != HTTP_CONTINUE || cupsFinishDocument(http, name) != IPP_OK)
 
1517
    if (status != HTTP_STATUS_CONTINUE || cupsFinishDocument(http, name) != IPP_STATUS_OK)
1515
1518
    {
1516
1519
     /*
1517
1520
      * Unable to queue, cancel the job and return...
1577
1580
  * Create a Send-Document request...
1578
1581
  */
1579
1582
 
1580
 
  if ((request = ippNewRequest(IPP_SEND_DOCUMENT)) == NULL)
 
1583
  if ((request = ippNewRequest(IPP_OP_SEND_DOCUMENT)) == NULL)
1581
1584
  {
1582
 
    _cupsSetError(IPP_INTERNAL_ERROR, strerror(ENOMEM), 0);
1583
 
    return (HTTP_ERROR);
 
1585
    _cupsSetError(IPP_STATUS_ERROR_INTERNAL, strerror(ENOMEM), 0);
 
1586
    return (HTTP_STATUS_ERROR);
1584
1587
  }
1585
1588
 
1586
1589
  httpAssembleURIf(HTTP_URI_CODING_ALL, printer_uri, sizeof(printer_uri), "ipp",
1658
1661
  */
1659
1662
 
1660
1663
  if (httpAssembleURIf(HTTP_URI_CODING_ALL, uri, sizeof(uri), "ipp", NULL,
1661
 
                       "localhost", 0, "/printers/%s", name) != HTTP_URI_OK)
 
1664
                       "localhost", 0, "/printers/%s",
 
1665
                       name) < HTTP_URI_STATUS_OK)
1662
1666
  {
1663
 
    _cupsSetError(IPP_INTERNAL_ERROR, _("Unable to create printer-uri"), 1);
 
1667
    _cupsSetError(IPP_STATUS_ERROR_INTERNAL, _("Unable to create printer-uri"),
 
1668
                  1);
1664
1669
 
1665
1670
    *host     = '\0';
1666
1671
    *resource = '\0';
1675
1680
  */
1676
1681
 
1677
1682
  httpGetHostname(http, http_hostname, sizeof(http_hostname));
1678
 
  http_port = _httpAddrPort(http->hostaddr);
 
1683
  http_port = httpAddrPort(http->hostaddr);
1679
1684
 
1680
1685
 /*
1681
1686
  * Build an IPP_GET_PRINTER_ATTRIBUTES request, which requires the following
1687
1692
  *    requested-attributes
1688
1693
  */
1689
1694
 
1690
 
  request = ippNewRequest(IPP_GET_PRINTER_ATTRIBUTES);
 
1695
  request = ippNewRequest(IPP_OP_GET_PRINTER_ATTRIBUTES);
1691
1696
 
1692
1697
  ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri",
1693
1698
               NULL, uri);
1775
1780
 
1776
1781
            if (!_cups_strcasecmp(http_hostname, host) && *port == http_port)
1777
1782
              http2 = http;
1778
 
            else if ((http2 = httpConnectEncrypt(host, *port,
1779
 
                                                 cupsEncryption())) == NULL)
 
1783
            else if ((http2 = httpConnect2(host, *port, NULL, AF_UNSPEC,
 
1784
                                           cupsEncryption(), 1, 30000,
 
1785
                                           NULL)) == NULL)
1780
1786
            {
1781
1787
              DEBUG_puts("8cups_get_printer_uri: Unable to connect to server");
1782
1788
 
1818
1824
 
1819
1825
      if (!strncmp(resource, "/classes/", 9))
1820
1826
      {
1821
 
        _cupsSetError(IPP_INTERNAL_ERROR,
 
1827
        _cupsSetError(IPP_STATUS_ERROR_INTERNAL,
1822
1828
                      _("No printer-uri found for class"), 1);
1823
1829
 
1824
1830
        *host     = '\0';
1833
1839
    ippDelete(response);
1834
1840
  }
1835
1841
 
1836
 
  if (cupsLastError() != IPP_NOT_FOUND)
1837
 
    _cupsSetError(IPP_INTERNAL_ERROR, _("No printer-uri found"), 1);
 
1842
  if (cupsLastError() != IPP_STATUS_ERROR_NOT_FOUND)
 
1843
    _cupsSetError(IPP_STATUS_ERROR_INTERNAL, _("No printer-uri found"), 1);
1838
1844
 
1839
1845
  *host     = '\0';
1840
1846
  *resource = '\0';
1844
1850
 
1845
1851
 
1846
1852
/*
1847
 
 * End of "$Id: util.c 11173 2013-07-23 12:31:34Z msweet $".
 
1853
 * End of "$Id: util.c 10996 2013-05-29 11:51:34Z msweet $".
1848
1854
 */