]> git.ipfire.org Git - thirdparty/cups-filters.git/commitdiff
Do not do IPP request for printer-is-shared option for remote cups queues with CUPS... 91/head
authorZdenek Dohnal <zdohnal@redhat.com>
Mon, 18 Feb 2019 12:16:05 +0000 (13:16 +0100)
committerZdenek Dohnal <zdohnal@redhat.com>
Mon, 18 Feb 2019 12:16:05 +0000 (13:16 +0100)
utils/cups-browsed.c

index c1921d6f5fa3f35f016860bf3e39fafab5bd67b1..8ccb3ec3e0f1b8c53618ea518c1f23afb8067f8e 100644 (file)
@@ -450,6 +450,19 @@ static remote_printer_t
 #define HAVE_CUPS_1_6 1
 #endif
 
+/*
+ * Option 'printer-is-shared' cannot be set on remote CUPS
+ * queue and requests for setting it ends with error since
+ * 2.1.1. Define HAVE_CUPS_2_2 to do not send IPP request
+ * for setting 'printer-is-shared' option on remote CUPS queues
+ * for newer versions of CUPS.
+ */
+#if (CUPS_VERSION_MAJOR > 2) || (CUPS_VERSION_MINOR > 1)
+#define HAVE_CUPS_2_2 1
+#else
+#define HAVE_CUPS_2_2 0
+#endif
+
 /*
  * CUPS 1.6 makes various structures private and
  * introduces these ippGet and ippSet functions
@@ -5438,7 +5451,15 @@ gboolean update_cups_queues(gpointer unused) {
       }
       cupsEncodeOptions2(request, num_options, options, IPP_TAG_OPERATION);
       cupsEncodeOptions2(request, num_options, options, IPP_TAG_PRINTER);
-      ippDelete(cupsDoRequest(http, request, "/admin/"));
+      /*
+       * Do IPP request for printer-is-shared option only when we have
+       * network printer or if we have remote CUPS queue, do IPP request
+       * only if we have CUPS older than 2.2.
+       */
+      if (p->netprinter != 0 || !HAVE_CUPS_2_2)
+        ippDelete(cupsDoRequest(http, request, "/admin/"));
+      else
+        ippDelete(request);
       cupsFreeOptions(num_options, options);
       if (cupsLastError() > IPP_STATUS_OK_EVENTS_COMPLETE)
        debug_printf("Unable to modify the printer-is-shared bit (%s)!\n",