rpms/cups/F-11 cups-cups-get-classes.patch, NONE, 1.1 cups.spec, 1.491, 1.492

Tim Waugh twaugh at fedoraproject.org
Tue Jul 28 21:38:08 UTC 2009


Author: twaugh

Update of /cvs/pkgs/rpms/cups/F-11
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv17267

Modified Files:
	cups.spec 
Added Files:
	cups-cups-get-classes.patch 
Log Message:
* Tue Jul 28 2009 Tim Waugh <twaugh at redhat.com> 1:1.4-0.rc1.12
- Cheaply restore compatibility with 1.1.x by having cups_get_sdests()
  perform a CUPS_GET_CLASSES request if it is not sure it is talking
  to CUPS 1.2 or later (bug #512866).


cups-cups-get-classes.patch:
 dest.c |   52 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 52 insertions(+)

--- NEW FILE cups-cups-get-classes.patch ---
diff -up cups-1.4rc1/cups/dest.c.cups-get-classes cups-1.4rc1/cups/dest.c
--- cups-1.4rc1/cups/dest.c.cups-get-classes	2009-05-13 22:39:17.000000000 +0100
+++ cups-1.4rc1/cups/dest.c	2009-07-28 22:17:40.285709944 +0100
@@ -1735,6 +1735,7 @@ cups_get_sdests(http_t      *http,	/* I 
   char		uri[1024];		/* printer-uri value */
   int		num_options;		/* Number of options */
   cups_option_t	*options;		/* Options */
+  int		get_classes;		/* Whether we need to fetch class */
 #ifdef __APPLE__
   char		media_default[41];	/* Default paper size */
 #endif /* __APPLE__ */
@@ -1791,6 +1792,8 @@ cups_get_sdests(http_t      *http,	/* I 
   *    printer-uri [for IPP_GET_PRINTER_ATTRIBUTES]
   */
 
+  get_classes = (op == CUPS_GET_PRINTERS);
+
   request = ippNewRequest(op);
 
   ippAddStrings(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD,
@@ -1848,6 +1851,23 @@ cups_get_sdests(http_t      *http,	/* I 
 	    attr->value_tag != IPP_TAG_URI)
           continue;
 
+	if (get_classes &&
+
+	    /* Is this a class? */
+	    ((attr->value_tag == IPP_TAG_ENUM &&
+	      !strcmp(attr->name, "printer-type") &&
+	      (attr->values[0].integer & CUPS_PRINTER_CLASS)) ||
+
+	     /* Or, is this an attribute from CUPS 1.2 or later? */
+	     !strcmp(attr->name, "auth-info-required") ||
+	     !strncmp(attr->name, "marker-", 7) ||
+	     !strcmp(attr->name, "printer-commands") ||
+	     !strcmp(attr->name, "printer-is-shared")))
+	 /* We are talking to a recent enough CUPS server that
+	  * CUPS_GET_PRINTERS returns classes as well.
+	  */
+	  get_classes = 0;
+
         if (!strcmp(attr->name, "auth-info-required") ||
 	    !strcmp(attr->name, "device-uri") ||
 	    !strcmp(attr->name, "marker-change-time") ||
@@ -1939,6 +1959,28 @@ cups_get_sdests(http_t      *http,	/* I 
           continue;
       }
 
+     /*
+      * If we sent a CUPS_GET_CLASSES request, check whether
+      * CUPS_GET_PRINTERS already gave us this destination and exit
+      * early if so.
+      */
+
+      if (op == CUPS_GET_CLASSES)
+      {
+	int diff;
+	cups_find_dest (printer_name, NULL, num_dests, *dests, 0, &diff);
+	if (diff == 0)
+	{
+         /*
+	  * Found it.  The CUPS server already gave us the classes in
+	  * its CUPS_GET_PRINTERS response.
+	  */
+
+	  cupsFreeOptions(num_options, options);
+	  break;
+	}
+      }
+
       if ((dest = cups_add_dest(printer_name, NULL, &num_dests, dests)) != NULL)
       {
         dest->num_options = num_options;
@@ -1955,6 +1997,16 @@ cups_get_sdests(http_t      *http,	/* I 
   }
 
  /*
+  * If this is a CUPS_GET_PRINTERS request but we didn't see any
+  * classes we might be talking to an older CUPS server that requires
+  * CUPS_GET_CLASSES as well.
+  */
+
+  if (get_classes)
+    num_dests = cups_get_sdests (http, CUPS_GET_CLASSES, name,
+				 num_dests, dests);
+
+ /*
   * Return the count...
   */
 


Index: cups.spec
===================================================================
RCS file: /cvs/pkgs/rpms/cups/F-11/cups.spec,v
retrieving revision 1.491
retrieving revision 1.492
diff -u -p -r1.491 -r1.492
--- cups.spec	28 Jul 2009 16:58:02 -0000	1.491
+++ cups.spec	28 Jul 2009 21:38:08 -0000	1.492
@@ -10,7 +10,7 @@
 Summary: Common Unix Printing System
 Name: cups
 Version: 1.4
-Release: 0.%{pre}.11%{?dist}
+Release: 0.%{pre}.12%{?dist}
 License: GPLv2
 Group: System Environment/Daemons
 Source: ftp://ftp.easysw.com/pub/cups/test//cups-%{version}%{?pre}%{?svn}-source.tar.bz2
@@ -59,7 +59,8 @@ Patch32: cups-str3253.patch
 Patch33: cups-str3266.patch
 Patch34: cups-str3262.patch
 Patch35: cups-socket-snmp.patch
-Patch36: cups-avahi.patch
+Patch36: cups-cups-get-classes.patch
+Patch37: cups-avahi.patch
 Patch100: cups-lspp.patch
 Epoch: 1
 Url: http://www.cups.org/
@@ -216,7 +217,8 @@ module. 
 %patch33 -p1 -b .str3266
 %patch34 -p1 -b .str3262
 %patch35 -p1 -b .socket-snmp
-#%patch36 -p1 -b .avahi
+%patch36 -p1 -b .cups-get-classes
+#%patch37 -p1 -b .avahi
 
 %if %lspp
 %patch100 -p1 -b .lspp
@@ -509,6 +511,11 @@ rm -rf $RPM_BUILD_ROOT
 %{php_extdir}/phpcups.so
 
 %changelog
+* Tue Jul 28 2009 Tim Waugh <twaugh at redhat.com> 1:1.4-0.rc1.12
+- Cheaply restore compatibility with 1.1.x by having cups_get_sdests()
+  perform a CUPS_GET_CLASSES request if it is not sure it is talking
+  to CUPS 1.2 or later (bug #512866).
+
 * Tue Jul 28 2009 Tim Waugh <twaugh at redhat.com> 1:1.4-0.rc1.11
 - Temporarily added snmp option to socket backend for debugging purposes.
 - Prevent ipp backend looping with bad IPP devices (bug #476424,




More information about the scm-commits mailing list