rpms/cups/devel cups-str1515.patch,NONE,1.1 cups.spec,1.143,1.144

fedora-cvs-commits at redhat.com fedora-cvs-commits at redhat.com
Tue Mar 28 16:31:25 UTC 2006


Author: twaugh

Update of /cvs/dist/rpms/cups/devel
In directory cvs.devel.redhat.com:/tmp/cvs-serv17391

Modified Files:
	cups.spec 
Added Files:
	cups-str1515.patch 
Log Message:
* Tue Mar 28 2006 Tim Waugh <twaugh at redhat.com>
- Fix lpq -h (STR#1515, bug #186686).


cups-str1515.patch:
 lpq.c |   62 ++++++++++++++++++++++++++++++++++++++++++++------------------
 1 files changed, 44 insertions(+), 18 deletions(-)

--- NEW FILE cups-str1515.patch ---
--- cups-1.2rc1/berkeley/lpq.c.str1515	2006-01-29 14:39:44.000000000 +0000
+++ cups-1.2rc1/berkeley/lpq.c	2006-03-28 17:27:50.000000000 +0100
@@ -49,6 +49,7 @@
  * Local functions...
  */
 
+static http_t	*connect_server(const char *, http_t *);
 static int	show_jobs(const char *, http_t *, const char *,
 		          const char *, const int, const int);
 static void	show_printer(const char *, http_t *, const char *);
@@ -76,35 +77,23 @@
   int		num_dests;		/* Number of destinations */
   cups_dest_t	*dests;			/* Destinations */
   cups_lang_t	*language;		/* Language */
-#ifdef HAVE_SSL
-  http_encryption_t encryption;		/* Encryption? */
-#endif /* HAVE_SSL */
 
 
-  language = cupsLangDefault();
 
- /*
-  * Connect to the scheduler...
-  */
-
-  if ((http = httpConnectEncrypt(cupsServer(), ippPort(),
-                                 cupsEncryption())) == NULL)
-  {
-    _cupsLangPrintf(stderr, _("%s: Unable to contact server!\n"), argv[0]);
-    return (1);
-  }
 
  /*
   * Check for command-line options...
   */
 
+  http       = NULL;
   dest       = NULL;
   user       = NULL;
   id         = 0;
   interval   = 0;
   longstatus = 0;
   all        = 0;
-  num_dests  = cupsGetDests(&dests);
+  language   = cupsLangDefault();
+  num_dests  = 0;
 
   for (i = 1; i < argc; i ++)
     if (argv[i][0] == '+')
@@ -115,10 +104,10 @@
       {
         case 'E' : /* Encrypt */
 #ifdef HAVE_SSL
-	    encryption = HTTP_ENCRYPT_REQUIRED;
+	    cupsSetEncryption(HTTP_ENCRYPT_REQUIRED);
 
 	    if (http)
-	      httpEncryption(http, encryption);
+	      httpEncryption(http, HTTP_ENCRYPT_REQUIRED);
 #else
             _cupsLangPrintf(stderr,
 	                    _("%s: Sorry, no encryption support compiled in!\n"),
@@ -166,6 +155,11 @@
 	    if ((instance = strchr(dest, '/')) != NULL)
 	      *instance++ = '\0';
 
+            http = connect_server(argv[0], http);
+
+            if (num_dests == 0)
+              num_dests = cupsGetDests2(http, &dests);
+
             if (cupsGetDest(dest, instance, num_dests, dests) == NULL)
 	    {
 	      if (instance)
@@ -186,8 +180,11 @@
 	    break;
 
         case 'h' : /* Connect to host */
-	    if (http != NULL)
+	    if (http)
+	    {
 	      httpClose(http);
+	      http = NULL;
+	    }
 
 	    if (argv[i][2] != '\0')
               cupsSetServer(argv[i] + 2);
@@ -225,8 +222,13 @@
     else
       user = argv[i];
 
+  http = connect_server(argv[0], http);
+
   if (dest == NULL && !all)
   {
+    if (num_dests == 0)
+      num_dests = cupsGetDests2(http, &dests);
+
     for (i = 0; i < num_dests; i ++)
       if (dests[i].is_default)
 	dest = dests[i].name;
@@ -295,6 +297,30 @@
 
 
 /*
+ * 'connect_server()' - Connect to the server as necessary...
+ */
+
+static http_t *				/* O - New HTTP connection */
+connect_server(const char *command,	/* I - Command name */
+               http_t     *http)	/* I - Current HTTP connection */
+{
+  if (!http)
+  {
+    http = httpConnectEncrypt(cupsServer(), ippPort(),
+	                      cupsEncryption());
+
+    if (http == NULL)
+    {
+      _cupsLangPrintf(stderr, _("%s: Unable to connect to server\n"), command);
+      exit(1);
+    }
+  }
+
+  return (http);
+}
+
+
+/*
  * 'show_jobs()' - Show jobs.
  */
 


Index: cups.spec
===================================================================
RCS file: /cvs/dist/rpms/cups/devel/cups.spec,v
retrieving revision 1.143
retrieving revision 1.144
diff -u -r1.143 -r1.144
--- cups.spec	27 Mar 2006 14:45:39 -0000	1.143
+++ cups.spec	28 Mar 2006 16:31:19 -0000	1.144
@@ -27,6 +27,7 @@
 Patch4: cups-1.1.17-backend.patch
 Patch5: cups-ext.patch
 Patch6: cups-kde.patch
+Patch7: cups-str1515.patch
 Patch8: cups-logfileperm.patch
 Patch9: cups-1.1.17-rcp.patch
 Patch10: cups-1.1.17-ppdsdat.patch
@@ -113,6 +114,7 @@
 %patch4 -p1 -b .backend
 %patch5 -p1 -b .ext
 %patch6 -p1 -b .kde
+%patch7 -p1 -b .str1515
 %patch8 -p1 -b .logfileperm
 %patch9 -p1 -b .rcp
 %patch10 -p1 -b .ppdsdat
@@ -373,6 +375,9 @@
 %{cups_serverbin}/daemon/cups-lpd
 
 %changelog
+* Tue Mar 28 2006 Tim Waugh <twaugh at redhat.com>
+- Fix lpq -h (STR#1515, bug #186686).
+
 * Mon Mar 27 2006 Tim Waugh <twaugh at redhat.com> 1:1.2-0.2.rc1.1
 - Ship a printers.conf file, and a client.conf file.  That way, they get
   their SELinux file contexts set correctly.




More information about the fedora-cvs-commits mailing list