rpms/cups/devel cups-scheduler.patch,1.1,1.2

fedora-cvs-commits at redhat.com fedora-cvs-commits at redhat.com
Fri Apr 7 17:07:27 UTC 2006


Author: twaugh

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

Modified Files:
	cups-scheduler.patch 
Log Message:
Fixed patch.

cups-scheduler.patch:
 cert.c          |    4 +-
 client.c        |   95 +++++++++++++++++++++++++++-------------------------
 conf.c          |    7 ++-
 dirsvc.c        |   20 ++++++++---
 env.c           |   11 ++----
 ipp.c           |   29 +++++++++++++---
 job.c           |   38 ++++++++++++++-------
 job.h           |    6 +--
 main.c          |  101 ++++++++++++++------------------------------------------
 printers.c      |    9 +++-
 process.c       |   56 ++++++++++++++++---------------
 server.c        |    5 +-
 statbuf.c       |    8 ++--
 subscriptions.h |    6 +--
 14 files changed, 202 insertions(+), 193 deletions(-)

Index: cups-scheduler.patch
===================================================================
RCS file: /cvs/dist/rpms/cups/devel/cups-scheduler.patch,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- cups-scheduler.patch	7 Apr 2006 16:58:46 -0000	1.1
+++ cups-scheduler.patch	7 Apr 2006 17:07:23 -0000	1.2
@@ -1,260 +1,29 @@
---- cups-1.2rc1/scheduler/cert.c	2006-04-07 17:56:09.000000000 +0100
-+++ /tmp/tim/cups/scheduler/cert.c	2006-04-07 16:05:46.000000000 +0100
+--- cups-1.2rc1/scheduler/server.c.scheduler	2006-03-18 03:05:12.000000000 +0000
++++ cups-1.2rc1/scheduler/server.c	2006-04-07 18:03:36.000000000 +0100
 @@ -1,5 +1,5 @@
  /*
 - * "$Id$"
 + * "$Id$"
   *
-  *   Authentication certificate routines for the Common UNIX
-  *   Printing System (CUPS).
-@@ -426,5 +426,5 @@
- 
- 
- /*
-- * End of "$Id$".
-+ * End of "$Id$".
-  */
---- cups-1.2rc1/scheduler/client.c	2006-04-07 17:56:09.000000000 +0100
-+++ /tmp/tim/cups/scheduler/client.c	2006-04-06 23:37:08.000000000 +0100
-@@ -1,5 +1,5 @@
- /*
-- * "$Id$"
-+ * "$Id$"
-  *
-  *   Client routines for the Common UNIX Printing System (CUPS) scheduler.
-  *
-@@ -957,7 +957,7 @@
-       else
-         snprintf(locale, sizeof(locale), "%s.%s",
- 	         con->http.fields[HTTP_FIELD_ACCEPT_LANGUAGE], DefaultCharset);
--        
-+
-       con->language = cupsLangGet(locale);
-     }
-     else
-@@ -2246,7 +2246,11 @@
- 	    */
- 
-             if (!strncasecmp(buf, "Location:", 9))
-+	    {
-   	      cupsdSendHeader(con, HTTP_SEE_OTHER, NULL);
-+	      if (httpPrintf(HTTP(con), "Content-Length: 0\r\n") < 0)
-+		return (0);
-+	    }
- 	    else if (!strncasecmp(buf, "Status:", 7))
-   	      cupsdSendError(con, atoi(buf + 7));
- 	    else
-@@ -2470,6 +2474,8 @@
-       while (*ptr != '\0' && *ptr != ';')
-         ptr ++;
-     }
-+    else
-+      ptr ++;
-   }
- 
-   cupsdLogMessage(CUPSD_LOG_DEBUG2,
-@@ -2612,11 +2618,13 @@
-   return (1);
- 
- #  elif defined(HAVE_CDSASSL)
--  OSStatus	error;			/* Error info */
--  SSLContextRef	conn;			/* New connection */
--  CFArrayRef	certificatesArray;	/* Array containing certificates */
--  int		allowExpired;		/* Allow expired certificates? */
--  int		allowAnyRoot;		/* Allow any root certificate? */
-+  OSStatus		error;		/* Error info */
-+  SSLContextRef		conn;		/* New connection */
-+  CFArrayRef		certificatesArray;
-+					/* Array containing certificates */
-+  int			allowExpired;	/* Allow expired certificates? */
-+  int			allowAnyRoot;	/* Allow any root certificate? */
-+  cdsa_conn_ref_t	u;		/* Connection reference union */
- 
- 
-   conn         = NULL;
-@@ -2641,12 +2649,23 @@
-     error = SSLSetProtocolVersion(conn, kSSLProtocol3);
- 
-   if (!error)
--    error = SSLSetConnection(conn, (SSLConnectionRef)con->http.fd);
-+  {
-+   /*
-+    * Use a union to resolve warnings about int/pointer size mismatches...
-+    */
-+
-+    u.connection = NULL;
-+    u.sock       = con->http.fd;
-+    error        = SSLSetConnection(conn, u.connection);
-+  }
- 
-   if (!error)
-     error = SSLSetPeerDomainName(conn, ServerName, strlen(ServerName) + 1);
- 
--  /* have to do these options before setting server certs */
-+ /*
-+  * Have to set these options before setting server certs...
-+  */
-+
-   if (!error && allowExpired)
-     error = SSLSetAllowsExpiredCerts(conn, true);
- 
-@@ -2826,9 +2845,9 @@
-     else
-       return (NULL);
-   }
--  else if (con->language != NULL)
-+  else if (con->language)
-     snprintf(filename, len, "%s/%s%s", DocumentRoot, con->language->language,
--            con->uri);
-+             con->uri);
-   else
-     snprintf(filename, len, "%s%s", DocumentRoot, con->uri);
- 
-@@ -2840,44 +2859,30 @@
-   * then fallback to the default one...
-   */
- 
--  if ((status = stat(filename, filestats)) != 0 && con->language != NULL)
--  {
--    /* Try removing the country code, if there is one. */
--    if (strncmp(con->uri, "/ppd/", 5) != 0 &&
--        strncmp(con->uri, "/admin/conf/", 12) != 0)
--    {
--      char *bare_lang = NULL;
--      size_t ln = strcspn (con->language->language, "_");
--      if (con->language->language[ln] == '_')
--      {
--	bare_lang = malloc (sizeof (char) * (ln + 1));
--	if (bare_lang)
--	{
--	  memcpy (bare_lang, con->language->language, ln);
--	  bare_lang[ln] = '\0';
--	  snprintf(filename, len,
--		   "%s/%s%s", DocumentRoot, bare_lang, con->uri);
--
--	  if ((ptr = strchr(filename, '?')) != NULL)
--	    *ptr = '\0';
--
--	  status = stat(filename, filestats);
--	  free (bare_lang);
--	}
--      }
--    }
--  }
--  
--  if (status != 0 && con->language != NULL)
-+  if ((status = stat(filename, filestats)) != 0 && con->language &&
-+      strncmp(con->uri, "/ppd/", 5) &&
-+      strncmp(con->uri, "/admin/conf/", 12) &&
-+      strncmp(con->uri, "/admin/log/", 11))
-   {
-    /*
--    * Drop the language prefix and try the current directory...
-+    * Drop the country code...
-     */
- 
--    if (strncmp(con->uri, "/ppd/", 5) &&
--        strncmp(con->uri, "/admin/conf/", 12) &&
--        strncmp(con->uri, "/admin/log/", 11))
-+    char	ll[3];			/* Short language name */
-+
-+
-+    strlcpy(ll, con->language->language, sizeof(ll));
-+    snprintf(filename, len, "%s/%s%s", DocumentRoot, ll, con->uri);
-+
-+    if ((ptr = strchr(filename, '?')) != NULL)
-+      *ptr = '\0';
-+
-+    if ((status = stat(filename, filestats)) != 0)
-     {
-+     /*
-+      * Drop the language prefix and try the root directory...
-+      */
-+
-       snprintf(filename, len, "%s%s", DocumentRoot, con->uri);
- 
-       if ((ptr = strchr(filename, '?')) != NULL)
-@@ -3815,5 +3820,5 @@
- 
- 
- /*
-- * End of "$Id$".
-+ * End of "$Id$".
-  */
---- cups-1.2rc1/scheduler/conf.c	2006-04-07 17:56:09.000000000 +0100
-+++ /tmp/tim/cups/scheduler/conf.c	2006-04-06 23:37:08.000000000 +0100
-@@ -1,5 +1,5 @@
- /*
-- * "$Id$"
-+ * "$Id$"
-  *
-  *   Configuration routines for the Common UNIX Printing System (CUPS).
-  *
-@@ -243,6 +243,7 @@
-   if (NumBrowsers > 0)
-   {
-     free(Browsers);
-+    Browsers = NULL;
- 
-     NumBrowsers = 0;
-   }
-@@ -281,7 +282,7 @@
-   cupsdSetString(&AccessLog, CUPS_LOGDIR "/access_log");
-   cupsdSetString(&ErrorLog, CUPS_LOGDIR "/error_log");
-   cupsdSetString(&PageLog, CUPS_LOGDIR "/page_log");
--  cupsdSetString(&Printcap, "/etc/printcap");
-+  cupsdSetString(&Printcap, CUPS_DEFAULT_PRINTCAP);
-   cupsdSetString(&PrintcapGUI, "/usr/bin/glpoptions");
-   cupsdSetString(&FontPath, CUPS_FONTPATH);
-   cupsdSetString(&RemoteRoot, "remroot");
-@@ -3251,5 +3252,5 @@
- 
- 
- /*
-- * End of "$Id$".
-+ * End of "$Id$".
-  */
---- cups-1.2rc1/scheduler/dirsvc.c	2006-03-23 21:07:20.000000000 +0000
-+++ /tmp/tim/cups/scheduler/dirsvc.c	2006-04-02 19:55:59.000000000 +0100
-@@ -1,5 +1,5 @@
- /*
-- * "$Id$"
-+ * "$Id$"
-  *
-  *   Directory services routines for the Common UNIX Printing System (CUPS).
+  *   Server start/stop routines for the Common UNIX Printing System (CUPS).
   *
-@@ -2471,8 +2471,20 @@
+@@ -119,7 +119,6 @@
  
-   dequote(location, p->location, sizeof(location));
-   dequote(info, p->info, sizeof(info));
--  dequote(make_model, p->make_model ? p->make_model : "Unknown",
--          sizeof(make_model));
-+
-+  if (p->make_model)
-+    dequote(make_model, p->make_model, sizeof(make_model));
-+  else if (p->type & CUPS_PRINTER_CLASS)
-+  {
-+    if (p->num_printers > 0 && p->printers[0]->make_model)
-+      strlcpy(make_model, p->printers[0]->make_model, sizeof(make_model));
-+    else
-+      strlcpy(make_model, "Local Printer Class", sizeof(make_model));
-+  }
-+  else if (p->raw)
-+    strlcpy(make_model, "Local Raw Printer", sizeof(make_model));
-+  else
-+    strlcpy(make_model, "Local System V Printer", sizeof(make_model));
+   LastEvent     = CUPSD_EVENT_PRINTER_CHANGED | CUPSD_EVENT_JOB_STATE_CHANGED |
+                   CUPSD_EVENT_SERVER_STARTED;
+-  LastEventTime = 0;
  
-  /*
-   * Send a packet to each browse address...
-@@ -3116,5 +3128,5 @@
+   started = 1;
+ }
+@@ -212,5 +211,5 @@
  
  
  /*
 - * End of "$Id$".
 + * End of "$Id$".
   */
---- cups-1.2rc1/scheduler/env.c	2006-03-18 03:05:12.000000000 +0000
-+++ /tmp/tim/cups/scheduler/env.c	2006-04-06 23:37:08.000000000 +0100
+--- cups-1.2rc1/scheduler/env.c.scheduler	2006-03-18 03:05:12.000000000 +0000
++++ cups-1.2rc1/scheduler/env.c	2006-04-07 18:03:36.000000000 +0100
 @@ -1,5 +1,5 @@
  /*
 - * "$Id$"
@@ -284,8 +53,8 @@
 - * End of "$Id$".
 + * End of "$Id$".
   */
---- cups-1.2rc1/scheduler/ipp.c	2006-03-24 01:20:03.000000000 +0000
-+++ /tmp/tim/cups/scheduler/ipp.c	2006-04-07 17:10:48.000000000 +0100
+--- cups-1.2rc1/scheduler/ipp.c.scheduler	2006-03-24 01:20:03.000000000 +0000
++++ cups-1.2rc1/scheduler/ipp.c	2006-04-07 18:03:36.000000000 +0100
 @@ -1,5 +1,5 @@
  /*
 - * "$Id$"
@@ -373,98 +142,132 @@
 - * End of "$Id$".
 + * End of "$Id$".
   */
---- cups-1.2rc1/scheduler/job.c	2006-03-18 03:05:12.000000000 +0000
-+++ /tmp/tim/cups/scheduler/job.c	2006-04-07 17:10:48.000000000 +0100
+--- cups-1.2rc1/scheduler/process.c.scheduler	2006-02-09 01:00:26.000000000 +0000
++++ cups-1.2rc1/scheduler/process.c	2006-04-07 18:03:36.000000000 +0100
 @@ -1,5 +1,5 @@
  /*
 - * "$Id$"
 + * "$Id$"
   *
-  *   Job management routines for the Common UNIX Printing System (CUPS).
+  *   Process management routines for the Common UNIX Printing System (CUPS).
   *
-@@ -386,7 +386,8 @@
- 	                 "job-actual-printer-uri", NULL, printer->uri);
- 	}
- 
--        if (printer->state == IPP_PRINTER_IDLE ||	/* Printer is idle */
-+        if ((!(printer->type & CUPS_PRINTER_REMOTE) &&	/* Printer is local */
-+	     printer->state == IPP_PRINTER_IDLE) ||	/* and idle */
- 	    ((printer->type & CUPS_PRINTER_REMOTE) &&	/* Printer is remote */
- 	     !printer->job))				/* and not printing */
- 	  start_job(job, printer);
-@@ -1066,26 +1067,31 @@
-  */
+@@ -35,9 +35,9 @@
  
- void
--cupsdMoveJob(cupsd_job_t *job,		/* I - Job */
--             const char  *dest)		/* I - Destination */
-+cupsdMoveJob(cupsd_job_t     *job,	/* I - Job */
-+             cupsd_printer_t *p)	/* I - Destination printer or class */
- {
-   ipp_attribute_t	*attr;		/* job-printer-uri attribute */
--  cupsd_printer_t	*p;		/* Destination printer or class */
-+  const char		*olddest;	/* Old destination */
-+  cupsd_printer_t	*oldp;		/* Old pointer */
+ #include "cupsd.h"
+ #include <grp.h>
+-#if defined(__APPLE__) && __GNUC__ < 4
++#if defined(__APPLE__)
+ #  include <libgen.h>
+-#endif /* __APPLE__ && __GNUC__ < 4 */ 
++#endif /* __APPLE__ */ 
  
  
-  /*
--  * Find the printer...
-+  * Don't move completed jobs...
-   */
+ /*
+@@ -128,45 +128,47 @@
+ #if defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET)
+   struct sigaction action;		/* POSIX signal handler */
+ #endif /* HAVE_SIGACTION && !HAVE_SIGSET */
+-#if defined(__APPLE__) && __GNUC__ < 4
+-  int		envc;			/* Number of environment variables */
++#if defined(__APPLE__)
+   char		processPath[1024],	/* CFProcessPath environment variable */
+ 		linkpath[1024];		/* Link path for symlinks... */
+   int		linkbytes;		/* Bytes for link path */
+-#endif /* __APPLE__ && __GNUC__ < 4 */
++#endif /* __APPLE__ */
  
--  if ((p = cupsdFindDest(dest)) == NULL)
-+  if (job->state_value > IPP_JOB_STOPPED)
-     return;
  
-  /*
--  * Don't move completed jobs...
-+  * Get the old destination...
-   */
+   cupsdLogMessage(CUPSD_LOG_DEBUG2,
+                   "cupsdStartProcess(\"%s\", %p, %p, %d, %d, %d)",
+                   command, argv, envp, infd, outfd, errfd);
  
--  if (job->state_value >= IPP_JOB_PROCESSING)
--    return;
-+  olddest = job->dest;
+-#if defined(__APPLE__) && __GNUC__ < 4
+- /*
+-  * Add special voodoo magic for MacOS X 10.3 and earlier - this allows
+-  * MacOS X programs to access their bundle resources properly...
+-  */
+-
+-  if ((linkbytes = readlink(command, linkpath, sizeof(linkpath) - 1)) > 0)
++#if defined(__APPLE__)
++  if (envp)
+   {
+    /*
+-    * Yes, this is a symlink to the actual program, nul-terminate and
+-    * use it...
++    * Add special voodoo magic for MacOS X - this allows MacOS X 
++    * programs to access their bundle resources properly...
+     */
+ 
+-    linkpath[linkbytes] = '\0';
++    if ((linkbytes = readlink(command, linkpath, sizeof(linkpath) - 1)) > 0)
++    {
++     /*
++      * Yes, this is a symlink to the actual program, nul-terminate and
++      * use it...
++      */
 +
-+  if (job->printer)
-+    oldp = job->printer;
-+  else
-+    oldp = cupsdFindDest(olddest);
++      linkpath[linkbytes] = '\0';
  
-  /*
-   * Change the destination information...
-@@ -1093,7 +1099,11 @@
+-    if (linkpath[0] == '/')
+-      snprintf(processPath, sizeof(processPath), "CFProcessPath=%s",
+-	       linkpath);
++      if (linkpath[0] == '/')
++	snprintf(processPath, sizeof(processPath), "CFProcessPath=%s",
++		 linkpath);
++      else
++	snprintf(processPath, sizeof(processPath), "CFProcessPath=%s/%s",
++		 dirname(command), linkpath);
++    }
+     else
+-      snprintf(processPath, sizeof(processPath), "CFProcessPath=%s/%s",
+-	       dirname(command), linkpath);
+-  }
+-  else
+-    snprintf(processPath, sizeof(processPath), "CFProcessPath=%s", command);
++      snprintf(processPath, sizeof(processPath), "CFProcessPath=%s", command);
  
-   cupsdLoadJob(job);
+-  envp[0] = processPath;		/* Replace <CFProcessPath> string */
+-#endif	/* __APPLE__ && __GNUC__ > 3 */
++    envp[0] = processPath;		/* Replace <CFProcessPath> string */
++  }
++#endif	/* __APPLE__ */
  
--  cupsdSetString(&job->dest, dest);
-+  cupsdAddEvent(CUPSD_EVENT_JOB_STOPPED, oldp, job,
-+                "Job #%d moved from %s to %s.", job->id, olddest,
-+		p->name);
-+
-+  cupsdSetString(&job->dest, p->name);
-   job->dtype = p->type & (CUPS_PRINTER_CLASS | CUPS_PRINTER_REMOTE |
-                           CUPS_PRINTER_IMPLICIT);
+  /*
+   * Block signals before forking...
+@@ -342,5 +344,5 @@
  
-@@ -1101,6 +1111,10 @@
-                                IPP_TAG_URI)) != NULL)
-     cupsdSetString(&(attr->values[0].string.text), p->uri);
  
-+  cupsdAddEvent(CUPSD_EVENT_JOB_STOPPED, p, job,
-+                "Job #%d moved from %s to %s.", job->id, olddest,
-+		p->name);
-+
-   cupsdSaveJob(job);
- }
+ /*
+- * End of "$Id$".
++ * End of "$Id$".
+  */
+--- cups-1.2rc1/scheduler/subscriptions.h.scheduler	2006-03-18 03:05:12.000000000 +0000
++++ cups-1.2rc1/scheduler/subscriptions.h	2006-04-07 18:03:36.000000000 +0100
+@@ -1,5 +1,5 @@
+ /*
+- * "$Id$"
++ * "$Id$"
+  *
+  *   Subscription definitions for the Common UNIX Printing System (CUPS) scheduler.
+  *
+@@ -136,8 +136,6 @@
+ VAR cupsd_event_t **Events VALUE(NULL);	/* Active events */
  
-@@ -3373,5 +3387,5 @@
+ VAR unsigned	LastEvent VALUE(0);	/* Last events processed */
+-VAR time_t	LastEventTime VALUE(0);	/* Time that the last events were sent */
+-
+ VAR int		NotifierPipes[2] VALUE2(-1, -1);
+ 					/* Pipes for notifier error/debug output */
+ VAR cupsd_statbuf_t *NotifierStatusBuffer VALUE(NULL);
+@@ -172,5 +170,5 @@
  
  
  /*
 - * End of "$Id$".
 + * End of "$Id$".
   */
---- cups-1.2rc1/scheduler/job.h	2006-03-18 03:05:12.000000000 +0000
-+++ /tmp/tim/cups/scheduler/job.h	2006-04-07 17:10:48.000000000 +0100
+--- cups-1.2rc1/scheduler/job.h.scheduler	2006-03-18 03:05:12.000000000 +0000
++++ cups-1.2rc1/scheduler/job.h	2006-04-07 18:03:36.000000000 +0100
 @@ -1,5 +1,5 @@
  /*
 - * "$Id$"
@@ -488,8 +291,69 @@
 - * End of "$Id$".
 + * End of "$Id$".
   */
---- cups-1.2rc1/scheduler/main.c	2006-04-07 17:56:09.000000000 +0100
-+++ /tmp/tim/cups/scheduler/main.c	2006-04-07 17:10:48.000000000 +0100
+--- cups-1.2rc1/scheduler/conf.c.scheduler	2006-04-07 18:03:35.000000000 +0100
++++ cups-1.2rc1/scheduler/conf.c	2006-04-07 18:03:36.000000000 +0100
+@@ -1,5 +1,5 @@
+ /*
+- * "$Id$"
++ * "$Id$"
+  *
+  *   Configuration routines for the Common UNIX Printing System (CUPS).
+  *
+@@ -243,6 +243,7 @@
+   if (NumBrowsers > 0)
+   {
+     free(Browsers);
++    Browsers = NULL;
+ 
+     NumBrowsers = 0;
+   }
+@@ -281,7 +282,7 @@
+   cupsdSetString(&AccessLog, CUPS_LOGDIR "/access_log");
+   cupsdSetString(&ErrorLog, CUPS_LOGDIR "/error_log");
+   cupsdSetString(&PageLog, CUPS_LOGDIR "/page_log");
+-  cupsdSetString(&Printcap, "/etc/printcap");
++  cupsdSetString(&Printcap, CUPS_DEFAULT_PRINTCAP);
+   cupsdSetString(&PrintcapGUI, "/usr/bin/glpoptions");
+   cupsdSetString(&FontPath, CUPS_FONTPATH);
+   cupsdSetString(&RemoteRoot, "remroot");
+@@ -3251,5 +3252,5 @@
+ 
+ 
+ /*
+- * End of "$Id$".
++ * End of "$Id$".
+  */
+--- cups-1.2rc1/scheduler/printers.c.scheduler	2006-03-23 21:07:20.000000000 +0000
++++ cups-1.2rc1/scheduler/printers.c	2006-04-07 18:03:36.000000000 +0100
+@@ -1,5 +1,5 @@
+ /*
+- * "$Id$"
++ * "$Id$"
+  *
+  *   Printer routines for the Common UNIX Printing System (CUPS).
+  *
+@@ -2271,6 +2271,11 @@
+ 
+   if (old_state != s)
+   {
++    cupsdAddEvent(CUPSD_EVENT_PRINTER_STATE_CHANGED, p, NULL,
++		  "%s \"%s\" state changed.",
++		  (p->type & CUPS_PRINTER_CLASS) ? "Class" : "Printer",
++		  p->name);
++
+    /*
+     * Let the browse code know this needs to be updated...
+     */
+@@ -3273,5 +3278,5 @@
+ 
+ 
+ /*
+- * End of "$Id$".
++ * End of "$Id$".
+  */
+--- cups-1.2rc1/scheduler/main.c.scheduler	2006-04-07 18:03:35.000000000 +0100
++++ cups-1.2rc1/scheduler/main.c	2006-04-07 18:03:36.000000000 +0100
 @@ -1,5 +1,5 @@
  /*
 - * "$Id$"
@@ -540,41 +404,7 @@
      else
      {
        _cupsLangPrintf(stderr, _("cupsd: Unknown argument \"%s\" - aborting!\n"),
-@@ -262,8 +245,6 @@
-     * Setup signal handlers for the parent...
-     */
- 
--    pid_t pid;
--
- #ifdef HAVE_SIGSET /* Use System V signals over POSIX to avoid bugs */
-     sigset(SIGUSR1, parent_handler);
-     sigset(SIGCHLD, parent_handler);
-@@ -287,7 +268,7 @@
-     signal(SIGHUP, SIG_IGN);
- #endif /* HAVE_SIGSET */
- 
--    if ((pid = fork()) > 0)
-+    if (fork() > 0)
-     {
-      /*
-       * OK, wait for the child to startup and send us SIGUSR1 or to crash
-@@ -299,15 +280,7 @@
-         sleep(1);
- 
-       if (parent_signal == SIGUSR1)
--      {
--        FILE *f = fopen ("/var/run/cupsd.pid", "w");
--        if (f)
--        {
--          fprintf (f, "%d\n", pid);
--          fclose (f);
--        }
-         return (0);
--      }
- 
-       if (wait(&i) < 0)
-       {
-@@ -487,9 +460,6 @@
+@@ -477,9 +460,6 @@
    signal(SIGTERM, sigterm_handler);
  #endif /* HAVE_SIGSET */
  
@@ -584,7 +414,7 @@
  #ifdef __sgi
   /*
    * Try to create a fake lpsched lock file if one is not already there.
-@@ -1042,7 +1012,7 @@
+@@ -1032,7 +1012,7 @@
      * accumulated.  Don't send these more than once a second...
      */
  
@@ -593,7 +423,7 @@
      {
  #ifdef HAVE_NOTIFY_POST
        if (LastEvent & CUPSD_EVENT_PRINTER_CHANGED)
-@@ -1070,10 +1040,9 @@
+@@ -1060,10 +1040,9 @@
  #endif /* HAVE_NOTIFY_POST */
  
       /*
@@ -605,7 +435,7 @@
        LastEvent     = CUPSD_EVENT_NONE;
      }
    }
-@@ -1220,7 +1189,7 @@
+@@ -1210,7 +1189,7 @@
  {
    if (s && *s)
    {
@@ -614,7 +444,7 @@
      *s = NULL;
    }
  }
-@@ -1286,10 +1255,10 @@
+@@ -1276,10 +1255,10 @@
      return;
  
    if (*s)
@@ -627,7 +457,7 @@
    else
      *s = NULL;
  }
-@@ -1320,13 +1289,13 @@
+@@ -1310,13 +1289,13 @@
      vsnprintf(v, sizeof(v), f, ap);
      va_end(ap);
  
@@ -643,7 +473,7 @@
  }
  
  
-@@ -1345,12 +1314,10 @@
+@@ -1335,12 +1314,10 @@
  			ld_resp,	/* Launch data response */
  			ld_array,	/* Launch data array */
  			ld_sockets,	/* Launch data sockets dictionary */
@@ -656,7 +486,7 @@
  
  
    cupsdLogMessage(CUPSD_LOG_DEBUG, "launchd_checkin: pid=%d", (int)getpid());
-@@ -1377,26 +1344,6 @@
+@@ -1367,26 +1344,6 @@
    }
  
   /*
@@ -683,7 +513,7 @@
    * Get the sockets dictionary...
    */
  
-@@ -1489,18 +1436,22 @@
+@@ -1479,18 +1436,22 @@
    {
      if (launch_data_get_type(ld_array) == LAUNCH_DATA_ARRAY)
      {
@@ -717,7 +547,7 @@
     }
     else
       cupsdLogMessage(CUPSD_LOG_WARN,
-@@ -2138,13 +2089,6 @@
+@@ -2128,13 +2089,6 @@
      return (1);
  
   /*
@@ -731,7 +561,7 @@
    * Otherwise, check all of the possible events that we need to wake for...
    */
  
-@@ -2290,18 +2234,17 @@
+@@ -2280,18 +2234,17 @@
  usage(int status)			/* O - Exit status */
  {
    _cupsLangPuts(status ? stderr : stdout,
@@ -753,203 +583,339 @@
 - * End of "$Id$".
 + * End of "$Id$".
   */
---- cups-1.2rc1/scheduler/printers.c	2006-03-23 21:07:20.000000000 +0000
-+++ /tmp/tim/cups/scheduler/printers.c	2006-04-06 23:37:08.000000000 +0100
+--- cups-1.2rc1/scheduler/statbuf.c.scheduler	2006-02-04 17:39:51.000000000 +0000
++++ cups-1.2rc1/scheduler/statbuf.c	2006-04-07 18:03:36.000000000 +0100
 @@ -1,5 +1,5 @@
  /*
 - * "$Id$"
 + * "$Id$"
   *
-  *   Printer routines for the Common UNIX Printing System (CUPS).
-  *
-@@ -2271,6 +2271,11 @@
+  *   Status buffer routines for the Common UNIX Printing System (CUPS)
+  *   scheduler.
+@@ -317,7 +317,9 @@
+   * Copy over the buffer data we've used up...
+   */
  
-   if (old_state != s)
-   {
-+    cupsdAddEvent(CUPSD_EVENT_PRINTER_STATE_CHANGED, p, NULL,
-+		  "%s \"%s\" state changed.",
-+		  (p->type & CUPS_PRINTER_CLASS) ? "Class" : "Printer",
-+		  p->name);
+-  _cups_strcpy(sb->buffer, lineptr);
++  if (lineptr < sb->buffer + sb->bufused)
++    _cups_strcpy(sb->buffer, lineptr);
 +
-    /*
-     * Let the browse code know this needs to be updated...
-     */
-@@ -3273,5 +3278,5 @@
+   sb->bufused -= lineptr - sb->buffer;
+ 
+   if (sb->bufused < 0)
+@@ -328,5 +330,5 @@
  
  
  /*
 - * End of "$Id$".
 + * End of "$Id$".
   */
---- cups-1.2rc1/scheduler/process.c	2006-02-09 01:00:26.000000000 +0000
-+++ /tmp/tim/cups/scheduler/process.c	2006-04-06 23:37:08.000000000 +0100
+--- cups-1.2rc1/scheduler/cert.c.scheduler	2006-04-07 18:03:36.000000000 +0100
++++ cups-1.2rc1/scheduler/cert.c	2006-04-07 18:03:36.000000000 +0100
 @@ -1,5 +1,5 @@
  /*
 - * "$Id$"
 + * "$Id$"
   *
-  *   Process management routines for the Common UNIX Printing System (CUPS).
-  *
-@@ -35,9 +35,9 @@
- 
- #include "cupsd.h"
- #include <grp.h>
--#if defined(__APPLE__) && __GNUC__ < 4
-+#if defined(__APPLE__)
- #  include <libgen.h>
--#endif /* __APPLE__ && __GNUC__ < 4 */ 
-+#endif /* __APPLE__ */ 
- 
- 
- /*
-@@ -128,45 +128,47 @@
- #if defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET)
-   struct sigaction action;		/* POSIX signal handler */
- #endif /* HAVE_SIGACTION && !HAVE_SIGSET */
--#if defined(__APPLE__) && __GNUC__ < 4
--  int		envc;			/* Number of environment variables */
-+#if defined(__APPLE__)
-   char		processPath[1024],	/* CFProcessPath environment variable */
- 		linkpath[1024];		/* Link path for symlinks... */
-   int		linkbytes;		/* Bytes for link path */
--#endif /* __APPLE__ && __GNUC__ < 4 */
-+#endif /* __APPLE__ */
- 
- 
-   cupsdLogMessage(CUPSD_LOG_DEBUG2,
-                   "cupsdStartProcess(\"%s\", %p, %p, %d, %d, %d)",
-                   command, argv, envp, infd, outfd, errfd);
- 
--#if defined(__APPLE__) && __GNUC__ < 4
-- /*
--  * Add special voodoo magic for MacOS X 10.3 and earlier - this allows
--  * MacOS X programs to access their bundle resources properly...
--  */
--
--  if ((linkbytes = readlink(command, linkpath, sizeof(linkpath) - 1)) > 0)
-+#if defined(__APPLE__)
-+  if (envp)
-   {
-    /*
--    * Yes, this is a symlink to the actual program, nul-terminate and
--    * use it...
-+    * Add special voodoo magic for MacOS X - this allows MacOS X 
-+    * programs to access their bundle resources properly...
-     */
- 
--    linkpath[linkbytes] = '\0';
-+    if ((linkbytes = readlink(command, linkpath, sizeof(linkpath) - 1)) > 0)
-+    {
-+     /*
-+      * Yes, this is a symlink to the actual program, nul-terminate and
-+      * use it...
-+      */
- 
--    if (linkpath[0] == '/')
--      snprintf(processPath, sizeof(processPath), "CFProcessPath=%s",
--	       linkpath);
-+      linkpath[linkbytes] = '\0';
-+
-+      if (linkpath[0] == '/')
-+	snprintf(processPath, sizeof(processPath), "CFProcessPath=%s",
-+		 linkpath);
-+      else
-+	snprintf(processPath, sizeof(processPath), "CFProcessPath=%s/%s",
-+		 dirname(command), linkpath);
-+    }
-     else
--      snprintf(processPath, sizeof(processPath), "CFProcessPath=%s/%s",
--	       dirname(command), linkpath);
--  }
--  else
--    snprintf(processPath, sizeof(processPath), "CFProcessPath=%s", command);
-+      snprintf(processPath, sizeof(processPath), "CFProcessPath=%s", command);
- 
--  envp[0] = processPath;		/* Replace <CFProcessPath> string */
--#endif	/* __APPLE__ && __GNUC__ > 3 */
-+    envp[0] = processPath;		/* Replace <CFProcessPath> string */
-+  }
-+#endif	/* __APPLE__ */
- 
-  /*
-   * Block signals before forking...
-@@ -342,5 +344,5 @@
+  *   Authentication certificate routines for the Common UNIX
+  *   Printing System (CUPS).
+@@ -426,5 +426,5 @@
  
  
  /*
 - * End of "$Id$".
 + * End of "$Id$".
   */
---- cups-1.2rc1/scheduler/server.c	2006-03-18 03:05:12.000000000 +0000
-+++ /tmp/tim/cups/scheduler/server.c	2006-04-06 23:37:08.000000000 +0100
+--- cups-1.2rc1/scheduler/dirsvc.c.scheduler	2006-03-23 21:07:20.000000000 +0000
++++ cups-1.2rc1/scheduler/dirsvc.c	2006-04-07 18:03:36.000000000 +0100
 @@ -1,5 +1,5 @@
  /*
 - * "$Id$"
 + * "$Id$"
   *
-  *   Server start/stop routines for the Common UNIX Printing System (CUPS).
+  *   Directory services routines for the Common UNIX Printing System (CUPS).
   *
-@@ -119,7 +119,6 @@
+@@ -2471,8 +2471,20 @@
  
-   LastEvent     = CUPSD_EVENT_PRINTER_CHANGED | CUPSD_EVENT_JOB_STATE_CHANGED |
-                   CUPSD_EVENT_SERVER_STARTED;
--  LastEventTime = 0;
+   dequote(location, p->location, sizeof(location));
+   dequote(info, p->info, sizeof(info));
+-  dequote(make_model, p->make_model ? p->make_model : "Unknown",
+-          sizeof(make_model));
++
++  if (p->make_model)
++    dequote(make_model, p->make_model, sizeof(make_model));
++  else if (p->type & CUPS_PRINTER_CLASS)
++  {
++    if (p->num_printers > 0 && p->printers[0]->make_model)
++      strlcpy(make_model, p->printers[0]->make_model, sizeof(make_model));
++    else
++      strlcpy(make_model, "Local Printer Class", sizeof(make_model));
++  }
++  else if (p->raw)
++    strlcpy(make_model, "Local Raw Printer", sizeof(make_model));
++  else
++    strlcpy(make_model, "Local System V Printer", sizeof(make_model));
  
-   started = 1;
- }
-@@ -212,5 +211,5 @@
+  /*
+   * Send a packet to each browse address...
+@@ -3116,5 +3128,5 @@
  
  
  /*
 - * End of "$Id$".
 + * End of "$Id$".
   */
---- cups-1.2rc1/scheduler/statbuf.c	2006-02-04 17:39:51.000000000 +0000
-+++ /tmp/tim/cups/scheduler/statbuf.c	2006-04-06 23:37:08.000000000 +0100
+--- cups-1.2rc1/scheduler/job.c.scheduler	2006-03-18 03:05:12.000000000 +0000
++++ cups-1.2rc1/scheduler/job.c	2006-04-07 18:03:36.000000000 +0100
 @@ -1,5 +1,5 @@
  /*
 - * "$Id$"
 + * "$Id$"
   *
-  *   Status buffer routines for the Common UNIX Printing System (CUPS)
-  *   scheduler.
-@@ -317,7 +317,9 @@
-   * Copy over the buffer data we've used up...
+  *   Job management routines for the Common UNIX Printing System (CUPS).
+  *
+@@ -386,7 +386,8 @@
+ 	                 "job-actual-printer-uri", NULL, printer->uri);
+ 	}
+ 
+-        if (printer->state == IPP_PRINTER_IDLE ||	/* Printer is idle */
++        if ((!(printer->type & CUPS_PRINTER_REMOTE) &&	/* Printer is local */
++	     printer->state == IPP_PRINTER_IDLE) ||	/* and idle */
+ 	    ((printer->type & CUPS_PRINTER_REMOTE) &&	/* Printer is remote */
+ 	     !printer->job))				/* and not printing */
+ 	  start_job(job, printer);
+@@ -1066,26 +1067,31 @@
+  */
+ 
+ void
+-cupsdMoveJob(cupsd_job_t *job,		/* I - Job */
+-             const char  *dest)		/* I - Destination */
++cupsdMoveJob(cupsd_job_t     *job,	/* I - Job */
++             cupsd_printer_t *p)	/* I - Destination printer or class */
+ {
+   ipp_attribute_t	*attr;		/* job-printer-uri attribute */
+-  cupsd_printer_t	*p;		/* Destination printer or class */
++  const char		*olddest;	/* Old destination */
++  cupsd_printer_t	*oldp;		/* Old pointer */
+ 
+ 
+  /*
+-  * Find the printer...
++  * Don't move completed jobs...
    */
  
--  _cups_strcpy(sb->buffer, lineptr);
-+  if (lineptr < sb->buffer + sb->bufused)
-+    _cups_strcpy(sb->buffer, lineptr);
+-  if ((p = cupsdFindDest(dest)) == NULL)
++  if (job->state_value > IPP_JOB_STOPPED)
+     return;
+ 
+  /*
+-  * Don't move completed jobs...
++  * Get the old destination...
+   */
+ 
+-  if (job->state_value >= IPP_JOB_PROCESSING)
+-    return;
++  olddest = job->dest;
 +
-   sb->bufused -= lineptr - sb->buffer;
++  if (job->printer)
++    oldp = job->printer;
++  else
++    oldp = cupsdFindDest(olddest);
  
-   if (sb->bufused < 0)
-@@ -328,5 +330,5 @@
+  /*
+   * Change the destination information...
+@@ -1093,7 +1099,11 @@
+ 
+   cupsdLoadJob(job);
+ 
+-  cupsdSetString(&job->dest, dest);
++  cupsdAddEvent(CUPSD_EVENT_JOB_STOPPED, oldp, job,
++                "Job #%d moved from %s to %s.", job->id, olddest,
++		p->name);
++
++  cupsdSetString(&job->dest, p->name);
+   job->dtype = p->type & (CUPS_PRINTER_CLASS | CUPS_PRINTER_REMOTE |
+                           CUPS_PRINTER_IMPLICIT);
+ 
+@@ -1101,6 +1111,10 @@
+                                IPP_TAG_URI)) != NULL)
+     cupsdSetString(&(attr->values[0].string.text), p->uri);
+ 
++  cupsdAddEvent(CUPSD_EVENT_JOB_STOPPED, p, job,
++                "Job #%d moved from %s to %s.", job->id, olddest,
++		p->name);
++
+   cupsdSaveJob(job);
+ }
+ 
+@@ -3373,5 +3387,5 @@
  
  
  /*
 - * End of "$Id$".
 + * End of "$Id$".
   */
---- cups-1.2rc1/scheduler/subscriptions.h	2006-03-18 03:05:12.000000000 +0000
-+++ /tmp/tim/cups/scheduler/subscriptions.h	2006-04-06 23:37:08.000000000 +0100
+--- cups-1.2rc1/scheduler/client.c.scheduler	2006-04-07 18:03:36.000000000 +0100
++++ cups-1.2rc1/scheduler/client.c	2006-04-07 18:03:36.000000000 +0100
 @@ -1,5 +1,5 @@
  /*
 - * "$Id$"
 + * "$Id$"
   *
-  *   Subscription definitions for the Common UNIX Printing System (CUPS) scheduler.
+  *   Client routines for the Common UNIX Printing System (CUPS) scheduler.
   *
-@@ -136,8 +136,6 @@
- VAR cupsd_event_t **Events VALUE(NULL);	/* Active events */
+@@ -957,7 +957,7 @@
+       else
+         snprintf(locale, sizeof(locale), "%s.%s",
+ 	         con->http.fields[HTTP_FIELD_ACCEPT_LANGUAGE], DefaultCharset);
+-        
++
+       con->language = cupsLangGet(locale);
+     }
+     else
+@@ -2246,7 +2246,11 @@
+ 	    */
  
- VAR unsigned	LastEvent VALUE(0);	/* Last events processed */
--VAR time_t	LastEventTime VALUE(0);	/* Time that the last events were sent */
+             if (!strncasecmp(buf, "Location:", 9))
++	    {
+   	      cupsdSendHeader(con, HTTP_SEE_OTHER, NULL);
++	      if (httpPrintf(HTTP(con), "Content-Length: 0\r\n") < 0)
++		return (0);
++	    }
+ 	    else if (!strncasecmp(buf, "Status:", 7))
+   	      cupsdSendError(con, atoi(buf + 7));
+ 	    else
+@@ -2470,6 +2474,8 @@
+       while (*ptr != '\0' && *ptr != ';')
+         ptr ++;
+     }
++    else
++      ptr ++;
+   }
+ 
+   cupsdLogMessage(CUPSD_LOG_DEBUG2,
+@@ -2612,11 +2618,13 @@
+   return (1);
+ 
+ #  elif defined(HAVE_CDSASSL)
+-  OSStatus	error;			/* Error info */
+-  SSLContextRef	conn;			/* New connection */
+-  CFArrayRef	certificatesArray;	/* Array containing certificates */
+-  int		allowExpired;		/* Allow expired certificates? */
+-  int		allowAnyRoot;		/* Allow any root certificate? */
++  OSStatus		error;		/* Error info */
++  SSLContextRef		conn;		/* New connection */
++  CFArrayRef		certificatesArray;
++					/* Array containing certificates */
++  int			allowExpired;	/* Allow expired certificates? */
++  int			allowAnyRoot;	/* Allow any root certificate? */
++  cdsa_conn_ref_t	u;		/* Connection reference union */
+ 
+ 
+   conn         = NULL;
+@@ -2641,12 +2649,23 @@
+     error = SSLSetProtocolVersion(conn, kSSLProtocol3);
+ 
+   if (!error)
+-    error = SSLSetConnection(conn, (SSLConnectionRef)con->http.fd);
++  {
++   /*
++    * Use a union to resolve warnings about int/pointer size mismatches...
++    */
++
++    u.connection = NULL;
++    u.sock       = con->http.fd;
++    error        = SSLSetConnection(conn, u.connection);
++  }
+ 
+   if (!error)
+     error = SSLSetPeerDomainName(conn, ServerName, strlen(ServerName) + 1);
+ 
+-  /* have to do these options before setting server certs */
++ /*
++  * Have to set these options before setting server certs...
++  */
++
+   if (!error && allowExpired)
+     error = SSLSetAllowsExpiredCerts(conn, true);
+ 
+@@ -2826,9 +2845,9 @@
+     else
+       return (NULL);
+   }
+-  else if (con->language != NULL)
++  else if (con->language)
+     snprintf(filename, len, "%s/%s%s", DocumentRoot, con->language->language,
+-            con->uri);
++             con->uri);
+   else
+     snprintf(filename, len, "%s%s", DocumentRoot, con->uri);
+ 
+@@ -2840,44 +2859,30 @@
+   * then fallback to the default one...
+   */
+ 
+-  if ((status = stat(filename, filestats)) != 0 && con->language != NULL)
+-  {
+-    /* Try removing the country code, if there is one. */
+-    if (strncmp(con->uri, "/ppd/", 5) != 0 &&
+-        strncmp(con->uri, "/admin/conf/", 12) != 0)
+-    {
+-      char *bare_lang = NULL;
+-      size_t ln = strcspn (con->language->language, "_");
+-      if (con->language->language[ln] == '_')
+-      {
+-	bare_lang = malloc (sizeof (char) * (ln + 1));
+-	if (bare_lang)
+-	{
+-	  memcpy (bare_lang, con->language->language, ln);
+-	  bare_lang[ln] = '\0';
+-	  snprintf(filename, len,
+-		   "%s/%s%s", DocumentRoot, bare_lang, con->uri);
 -
- VAR int		NotifierPipes[2] VALUE2(-1, -1);
- 					/* Pipes for notifier error/debug output */
- VAR cupsd_statbuf_t *NotifierStatusBuffer VALUE(NULL);
-@@ -172,5 +170,5 @@
+-	  if ((ptr = strchr(filename, '?')) != NULL)
+-	    *ptr = '\0';
+-
+-	  status = stat(filename, filestats);
+-	  free (bare_lang);
+-	}
+-      }
+-    }
+-  }
+-  
+-  if (status != 0 && con->language != NULL)
++  if ((status = stat(filename, filestats)) != 0 && con->language &&
++      strncmp(con->uri, "/ppd/", 5) &&
++      strncmp(con->uri, "/admin/conf/", 12) &&
++      strncmp(con->uri, "/admin/log/", 11))
+   {
+    /*
+-    * Drop the language prefix and try the current directory...
++    * Drop the country code...
+     */
+ 
+-    if (strncmp(con->uri, "/ppd/", 5) &&
+-        strncmp(con->uri, "/admin/conf/", 12) &&
+-        strncmp(con->uri, "/admin/log/", 11))
++    char	ll[3];			/* Short language name */
++
++
++    strlcpy(ll, con->language->language, sizeof(ll));
++    snprintf(filename, len, "%s/%s%s", DocumentRoot, ll, con->uri);
++
++    if ((ptr = strchr(filename, '?')) != NULL)
++      *ptr = '\0';
++
++    if ((status = stat(filename, filestats)) != 0)
+     {
++     /*
++      * Drop the language prefix and try the root directory...
++      */
++
+       snprintf(filename, len, "%s%s", DocumentRoot, con->uri);
+ 
+       if ((ptr = strchr(filename, '?')) != NULL)
+@@ -3815,5 +3820,5 @@
  
  
  /*




More information about the fedora-cvs-commits mailing list