Blame SOURCES/cups-browsed-error-messages.patch

48a090
diff --git a/utils/cups-browsed.c b/utils/cups-browsed.c
48a090
index 80bde46..54ae2ac 100644
48a090
--- a/utils/cups-browsed.c
48a090
+++ b/utils/cups-browsed.c
48a090
@@ -439,6 +439,19 @@ static remote_printer_t
48a090
 #define HAVE_CUPS_1_6 1
48a090
 #endif
48a090
 
48a090
+/*
48a090
+ * Option 'printer-is-shared' cannot be set on remote CUPS
48a090
+ * queue and requests for setting it ends with error since
48a090
+ * 2.1.1. Define HAVE_CUPS_2_2 to do not send IPP request
48a090
+ * for setting 'printer-is-shared' option on remote CUPS queues
48a090
+ * for newer versions of CUPS.
48a090
+ */
48a090
+#if (CUPS_VERSION_MAJOR > 2) || (CUPS_VERSION_MINOR > 1)
48a090
+#define HAVE_CUPS_2_2 1
48a090
+#else
48a090
+#define HAVE_CUPS_2_2 0
48a090
+#endif
48a090
+
48a090
 /*
48a090
  * CUPS 1.6 makes various structures private and
48a090
  * introduces these ippGet and ippSet functions
48a090
@@ -4394,7 +4407,20 @@ gboolean update_cups_queues(gpointer unused) {
48a090
 					num_options, &options);
48a090
 	    cupsEncodeOptions2(request, num_options, options, IPP_TAG_OPERATION);
48a090
 	    cupsEncodeOptions2(request, num_options, options, IPP_TAG_PRINTER);
48a090
-	    ippDelete(cupsDoRequest(http, request, "/admin/"));
48a090
+	    /*
48a090
+	     * Do IPP request for printer-is-shared option only when we have
48a090
+	     * network printer or if we have remote CUPS queue, do IPP request
48a090
+	     * only if we have CUPS older than 2.2.
48a090
+	     * When you have remote queue, clean up and break from the loop.
48a090
+	     */
48a090
+	    if (p->netprinter != 0 || !HAVE_CUPS_2_2)
48a090
+	      ippDelete(cupsDoRequest(http, request, "/admin/"));
48a090
+	    else
48a090
+	    {
48a090
+	      ippDelete(request);
48a090
+	      cupsFreeOptions(num_options, options);
48a090
+	      break;
48a090
+	    }
48a090
 	    cupsFreeOptions(num_options, options);
48a090
 	    if (cupsLastError() > IPP_STATUS_OK_EVENTS_COMPLETE) {
48a090
 	      debug_printf("Unable change printer-is-shared bit to %s (%s)!\n",
48a090
@@ -4803,7 +4829,15 @@ gboolean update_cups_queues(gpointer unused) {
48a090
       }
48a090
       cupsEncodeOptions2(request, num_options, options, IPP_TAG_OPERATION);
48a090
       cupsEncodeOptions2(request, num_options, options, IPP_TAG_PRINTER);
48a090
-      ippDelete(cupsDoRequest(http, request, "/admin/"));
48a090
+      /*
48a090
+       * Do IPP request for printer-is-shared option only when we have
48a090
+       * network printer or if we have remote CUPS queue, do IPP request
48a090
+       * only if we have CUPS older than 2.2.
48a090
+       */
48a090
+      if (p->netprinter != 0 || !HAVE_CUPS_2_2)
48a090
+        ippDelete(cupsDoRequest(http, request, "/admin/"));
48a090
+      else
48a090
+        ippDelete(request);
48a090
       cupsFreeOptions(num_options, options);
48a090
       if (cupsLastError() > IPP_STATUS_OK_EVENTS_COMPLETE)
48a090
 	debug_printf("Unable to set printer-is-shared bit to false (%s)!\n",