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

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