~ubuntu-branches/ubuntu/saucy/cups/saucy

« back to all changes in this revision

Viewing changes to .pc/ppd-poll-with-client-conf.patch/cups/util.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
Tags: 1.7.0~rc1-0ubuntu1
* 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: util.c 7850 2008-08-20 00:07:25Z mike $"
 
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);
1791
1796
 
1792
1797
            if (!_cups_strcasecmp(http_hostname, host) && *port == http_port)
1793
1798
              http2 = http;
1794
 
            else if ((http2 = httpConnectEncrypt(host, *port,
1795
 
                                                 cupsEncryption())) == NULL)
 
1799
            else if ((http2 = httpConnect2(host, *port, NULL, AF_UNSPEC,
 
1800
                                           cupsEncryption(), 1, 30000,
 
1801
                                           NULL)) == NULL)
1796
1802
            {
1797
1803
              DEBUG_puts("8cups_get_printer_uri: Unable to connect to server");
1798
1804
 
1834
1840
 
1835
1841
      if (!strncmp(resource, "/classes/", 9))
1836
1842
      {
1837
 
        _cupsSetError(IPP_INTERNAL_ERROR,
 
1843
        _cupsSetError(IPP_STATUS_ERROR_INTERNAL,
1838
1844
                      _("No printer-uri found for class"), 1);
1839
1845
 
1840
1846
        *host     = '\0';
1849
1855
    ippDelete(response);
1850
1856
  }
1851
1857
 
1852
 
  if (cupsLastError() != IPP_NOT_FOUND)
1853
 
    _cupsSetError(IPP_INTERNAL_ERROR, _("No printer-uri found"), 1);
 
1858
  if (cupsLastError() != IPP_STATUS_ERROR_NOT_FOUND)
 
1859
    _cupsSetError(IPP_STATUS_ERROR_INTERNAL, _("No printer-uri found"), 1);
1854
1860
 
1855
1861
  *host     = '\0';
1856
1862
  *resource = '\0';
1860
1866
 
1861
1867
 
1862
1868
/*
1863
 
 * End of "$Id: util.c 7850 2008-08-20 00:07:25Z mike $".
 
1869
 * End of "$Id: util.c 10996 2013-05-29 11:51:34Z msweet $".
1864
1870
 */