rpms/cups/FC-5 cups-scheduler.patch,NONE,1.1 cups.spec,1.148,1.149

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


Author: twaugh

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

Modified Files:
	cups.spec 
Added Files:
	cups-scheduler.patch 
Log Message:
* Fri Apr  7 2006 Tim Waugh <twaugh at redhat.com> 1:1.2-0.2.rc1.2.9
- Sync scheduler/* with svn 5383.


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(-)

--- NEW FILE cups-scheduler.patch ---
--- 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: server.c 5305 2006-03-18 03:05:12Z mike $"
+ * "$Id: server.c 5373 2006-04-06 20:03:32Z mike $"
  *
  *   Server start/stop routines for the Common UNIX Printing System (CUPS).
  *
@@ -119,7 +119,6 @@
 
   LastEvent     = CUPSD_EVENT_PRINTER_CHANGED | CUPSD_EVENT_JOB_STATE_CHANGED |
                   CUPSD_EVENT_SERVER_STARTED;
-  LastEventTime = 0;
 
   started = 1;
 }
@@ -212,5 +211,5 @@
 
 
 /*
- * End of "$Id: server.c 5305 2006-03-18 03:05:12Z mike $".
+ * End of "$Id: server.c 5373 2006-04-06 20:03:32Z mike $".
  */
--- 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: env.c 5305 2006-03-18 03:05:12Z mike $"
+ * "$Id: env.c 5373 2006-04-06 20:03:32Z mike $"
  *
  *   Environment management routines for the Common UNIX Printing System (CUPS).
  *
@@ -68,11 +68,10 @@
 
 #if defined(__APPLE__)
  /*
-  * Add special voodoo magic for MacOS X 10.4 and later - this allows MacOS
-  * X programs to access their bundle resources properly...
+  * Add special voodoo magic for MacOS X - this allows MacOS X 
+  * programs to access their bundle resources properly...
   *
-  * This string is replaced in cupsdStartProcess() when we are running on
-  * versions of MacOS X prior to 10.4...
+  * This string is replaced in cupsdStartProcess()...
   */
 
   cupsdSetString(common_env, "<CFProcessPath>");
@@ -246,5 +245,5 @@
 
 
 /*
- * End of "$Id: env.c 5305 2006-03-18 03:05:12Z mike $".
+ * End of "$Id: env.c 5373 2006-04-06 20:03:32Z mike $".
  */
--- 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: ipp.c 5334 2006-03-24 01:20:03Z mike $"
+ * "$Id: ipp.c 5383 2006-04-07 15:36:10Z mike $"
  *
  *   IPP routines for the Common UNIX Printing System (CUPS) scheduler.
  *
@@ -1489,10 +1489,13 @@
     */
 
     cupsdSetJobHoldUntil(job, attr->values[0].string.text);
+
+    job->state->values[0].integer = IPP_JOB_HELD;
+    job->state_value              = IPP_JOB_HELD;
   }
   else if (job->attrs->request.op.operation_id == IPP_CREATE_JOB)
   {
-    job->hold_until = time(NULL) + 60;
+    job->hold_until               = time(NULL) + 60;
     job->state->values[0].integer = IPP_JOB_HELD;
     job->state_value              = IPP_JOB_HELD;
   }
@@ -6525,7 +6528,7 @@
     * Move the job to a different printer or class...
     */
 
-    cupsdMoveJob(job, dest);
+    cupsdMoveJob(job, dprinter);
   }
   else
   {
@@ -6557,7 +6560,7 @@
       * Move the job to a different printer or class...
       */
 
-      cupsdMoveJob(job, dest);
+      cupsdMoveJob(job, dprinter);
     }
   }
 
@@ -8811,11 +8814,19 @@
   cupsdStartPrinter(printer, 1);
 
   if (dtype & CUPS_PRINTER_CLASS)
+  {
     cupsdLogMessage(CUPSD_LOG_INFO, "Class \"%s\" started by \"%s\".", name,
                     get_username(con));
+    cupsdAddEvent(CUPSD_EVENT_PRINTER_MODIFIED, printer, NULL,
+                  "Class \"%s\" started by \"%s\".", name, get_username(con));
+  }
   else
+  {
     cupsdLogMessage(CUPSD_LOG_INFO, "Printer \"%s\" started by \"%s\".", name,
                     get_username(con));
+    cupsdAddEvent(CUPSD_EVENT_PRINTER_MODIFIED, printer, NULL,
+                  "Printer \"%s\" started by \"%s\".", name, get_username(con));
+  }
 
   cupsdCheckJobs();
 
@@ -8899,11 +8910,19 @@
   cupsdStopPrinter(printer, 1);
 
   if (dtype & CUPS_PRINTER_CLASS)
+  {
     cupsdLogMessage(CUPSD_LOG_INFO, "Class \"%s\" stopped by \"%s\".", name,
                     get_username(con));
+    cupsdAddEvent(CUPSD_EVENT_PRINTER_MODIFIED, printer, NULL,
+                  "Class \"%s\" stopped by \"%s\".", name, get_username(con));
+  }
   else
+  {
     cupsdLogMessage(CUPSD_LOG_INFO, "Printer \"%s\" stopped by \"%s\".", name,
                     get_username(con));
+    cupsdAddEvent(CUPSD_EVENT_PRINTER_MODIFIED, printer, NULL,
+                  "Printer \"%s\" stopped by \"%s\".", name, get_username(con));
+  }
 
  /*
   * Everything was ok, so return OK status...
@@ -9137,5 +9156,5 @@
 
 
 /*
- * End of "$Id: ipp.c 5334 2006-03-24 01:20:03Z mike $".
+ * End of "$Id: ipp.c 5383 2006-04-07 15:36:10Z mike $".
  */
--- 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: process.c 5094 2006-02-09 01:00:26Z mike $"
+ * "$Id: process.c 5376 2006-04-06 20:32:07Z mike $"
  *
  *   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...
+      */
+
+      linkpath[linkbytes] = '\0';
 
-    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);
 
-  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 @@
 
 
 /*
- * End of "$Id: process.c 5094 2006-02-09 01:00:26Z mike $".
+ * End of "$Id: process.c 5376 2006-04-06 20:32:07Z mike $".
  */
--- 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: subscriptions.h 5305 2006-03-18 03:05:12Z mike $"
+ * "$Id: subscriptions.h 5373 2006-04-06 20:03:32Z mike $"
  *
  *   Subscription definitions for the Common UNIX Printing System (CUPS) scheduler.
  *
@@ -136,8 +136,6 @@
 VAR cupsd_event_t **Events VALUE(NULL);	/* Active events */
 
 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: subscriptions.h 5305 2006-03-18 03:05:12Z mike $".
+ * End of "$Id: subscriptions.h 5373 2006-04-06 20:03:32Z mike $".
  */
--- 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: job.h 5305 2006-03-18 03:05:12Z mike $"
+ * "$Id: job.h 5383 2006-04-07 15:36:10Z mike $"
  *
  *   Print job definitions for the Common UNIX Printing System (CUPS) scheduler.
  *
@@ -107,7 +107,7 @@
 extern void		cupsdHoldJob(cupsd_job_t *job);
 extern void		cupsdLoadAllJobs(void);
 extern void		cupsdLoadJob(cupsd_job_t *job);
-extern void		cupsdMoveJob(cupsd_job_t *job, const char *dest);
+extern void		cupsdMoveJob(cupsd_job_t *job, cupsd_printer_t *p);
 extern void		cupsdReleaseJob(cupsd_job_t *job);
 extern void		cupsdRestartJob(cupsd_job_t *job);
 extern void		cupsdSaveAllJobs(void);
@@ -120,5 +120,5 @@
 
 
 /*
- * End of "$Id: job.h 5305 2006-03-18 03:05:12Z mike $".
+ * End of "$Id: job.h 5383 2006-04-07 15:36:10Z mike $".
  */
--- 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: conf.c 5289 2006-03-14 11:54:45Z mike $"
+ * "$Id: conf.c 5373 2006-04-06 20:03:32Z mike $"
  *
  *   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: conf.c 5289 2006-03-14 11:54:45Z mike $".
+ * End of "$Id: conf.c 5373 2006-04-06 20:03:32Z mike $".
  */
--- 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: printers.c 5330 2006-03-23 21:07:20Z mike $"
+ * "$Id: printers.c 5373 2006-04-06 20:03:32Z mike $"
  *
  *   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: printers.c 5330 2006-03-23 21:07:20Z mike $".
+ * End of "$Id: printers.c 5373 2006-04-06 20:03:32Z mike $".
  */
--- 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: main.c 5305 2006-03-18 03:05:12Z mike $"
+ * "$Id: main.c 5383 2006-04-07 15:36:10Z mike $"
  *
  *   Scheduler main loop for the Common UNIX Printing System (CUPS).
  *
@@ -113,7 +113,6 @@
   int			i;		/* Looping var */
   char			*opt;		/* Option character */
   int			fg;		/* Run in the foreground */
-  int			only_ppds;	/* Just build ppds.dat */
   int			fds;		/* Number of ready descriptors */
   fd_set		*input,		/* Input set for select() */
 			*output;	/* Output set for select() */
@@ -149,25 +148,10 @@
   */
 
   fg = 0;
-  only_ppds = 0;
 
   for (i = 1; i < argc; i ++)
     if (argv[i][0] == '-')
-      {
-	if (argv[i][1] == '-')
-	{
-	  if (!strcmp (&argv[i][2], "ppdsdat"))
-	  {
-	    fg = only_ppds = 1;
-	  }
-	  else
-	  {
-            fprintf(stderr, "cupsd: Unknown option \'%s\' - aborting!\n",
-		    &argv[i][2]);
-	    usage(1);
-	  }
-	}
-	else for (opt = argv[i] + 1; *opt != '\0'; opt ++)
+      for (opt = argv[i] + 1; *opt != '\0'; opt ++)
         switch (*opt)
 	{
 	  case 'c' : /* Configuration file */
@@ -241,7 +225,6 @@
 	      usage(1);
 	      break;
 	}
-      }
     else
     {
       _cupsLangPrintf(stderr, _("cupsd: Unknown argument \"%s\" - aborting!\n"),
@@ -477,9 +460,6 @@
   signal(SIGTERM, sigterm_handler);
 #endif /* HAVE_SIGSET */
 
-  if (only_ppds)
-    return 0;
-
 #ifdef __sgi
  /*
   * Try to create a fake lpsched lock file if one is not already there.
@@ -1032,7 +1012,7 @@
     * accumulated.  Don't send these more than once a second...
     */
 
-    if (LastEvent && (time(NULL) - LastEventTime) > 1)
+    if (LastEvent)
     {
 #ifdef HAVE_NOTIFY_POST
       if (LastEvent & CUPSD_EVENT_PRINTER_CHANGED)
@@ -1060,10 +1040,9 @@
 #endif /* HAVE_NOTIFY_POST */
 
      /*
-      * Reset the accumulated events and notification time...
+      * Reset the accumulated events...
       */
 
-      LastEventTime = time(NULL);
       LastEvent     = CUPSD_EVENT_NONE;
     }
   }
@@ -1210,7 +1189,7 @@
 {
   if (s && *s)
   {
-    free(*s);
+    _cupsStrFree(*s);
     *s = NULL;
   }
 }
@@ -1276,10 +1255,10 @@
     return;
 
   if (*s)
-    free(*s);
+    _cupsStrFree(*s);
 
   if (v)
-    *s = strdup(v);
+    *s = _cupsStrAlloc(v);
   else
     *s = NULL;
 }
@@ -1310,13 +1289,13 @@
     vsnprintf(v, sizeof(v), f, ap);
     va_end(ap);
 
-    *s = strdup(v);
+    *s = _cupsStrAlloc(v);
   }
   else
     *s = NULL;
 
   if (olds)
-    free(olds);
+    _cupsStrFree(olds);
 }
 
 
@@ -1335,12 +1314,10 @@
 			ld_resp,	/* Launch data response */
 			ld_array,	/* Launch data array */
 			ld_sockets,	/* Launch data sockets dictionary */
-			ld_runatload,	/* Run-at-load setting */
 			tmp;		/* Launch data */
   cupsd_listener_t	*lis;		/* Listeners array */
   http_addr_t		addr;		/* Address variable */
   socklen_t		addrlen;	/* Length of address */
-  bool			runatload;	/* Run-at-load setting value */
 
 
   cupsdLogMessage(CUPSD_LOG_DEBUG, "launchd_checkin: pid=%d", (int)getpid());
@@ -1367,26 +1344,6 @@
   }
 
  /*
-  * Get the "run-at-load" setting...
-  */
-
-  if ((ld_runatload =
-           launch_data_dict_lookup(ld_resp, LAUNCH_JOBKEY_RUNATLOAD)) != NULL &&
-      launch_data_get_type(ld_runatload) == LAUNCH_DATA_BOOL)
-    runatload = launch_data_get_bool(ld_runatload);
-  else
-  {
-    errno = launch_data_get_errno(ld_resp);
-    cupsdLogMessage(CUPSD_LOG_ERROR,
-                    "launchd_checkin: Unable to find Run-at-load setting: %s",
-                    strerror(errno));
-    exit(EXIT_FAILURE);
-  }
-
-  cupsdLogMessage(CUPSD_LOG_DEBUG, "launchd_checkin: Run-at-load=%s",
-                  runatload ? "true" : "false");
-
- /*
   * Get the sockets dictionary...
   */
 
@@ -1479,18 +1436,22 @@
   {
     if (launch_data_get_type(ld_array) == LAUNCH_DATA_ARRAY)
     {
-      tmp = launch_data_array_get_index(ld_array, 0);
-
-      if (launch_data_get_type(tmp) == LAUNCH_DATA_FD)
+      if ((tmp = launch_data_array_get_index(ld_array, 0)))
       {
-        if (BrowseSocket != -1)
-	  close(BrowseSocket);
-
-	BrowseSocket = launch_data_get_fd(tmp);
-      }
-      else
-	cupsdLogMessage(CUPSD_LOG_WARN,
-	                "launchd_checkin: BrowseSocket not a fd!");
+	if (launch_data_get_type(tmp) == LAUNCH_DATA_FD)
+	{
+	  if (BrowseSocket != -1)
+	    close(BrowseSocket);
+  
+	  BrowseSocket = launch_data_get_fd(tmp);
+	}
+	else
+	  cupsdLogMessage(CUPSD_LOG_WARN,
+			  "launchd_checkin: BrowseSocket not a fd!");
+     }
+     else
+       cupsdLogMessage(CUPSD_LOG_WARN,
+		       "launchd_checkin: BrowseSockets is an empty array!");
    }
    else
      cupsdLogMessage(CUPSD_LOG_WARN,
@@ -2128,13 +2089,6 @@
     return (1);
 
  /*
-  * If we had a recent event notification, timeout in 1 second...
-  */
-
-  if (LastEvent)
-    return (1);
-
- /*
   * Otherwise, check all of the possible events that we need to wake for...
   */
 
@@ -2280,18 +2234,17 @@
 usage(int status)			/* O - Exit status */
 {
   _cupsLangPuts(status ? stderr : stdout,
-                _("Usage: cupsd [-c config-file] [-f] [-F] [-h] [-l] [--ppdsdat]\n"
+                _("Usage: cupsd [-c config-file] [-f] [-F] [-h] [-l]\n"
 		  "\n"
 		  "-c config-file      Load alternate configuration file\n"
 		  "-f                  Run in the foreground\n"
 		  "-F                  Run in the foreground but detach\n"
 		  "-h                  Show this usage message\n"
-		  "-l                  Run cupsd from launchd(8)\n"
-		  "--ppdsdat           Just build ppds.dat\n"));
+		  "-l                  Run cupsd from launchd(8)\n"));
   exit(status);
 }
 
 
 /*
- * End of "$Id: main.c 5305 2006-03-18 03:05:12Z mike $".
+ * End of "$Id: main.c 5383 2006-04-07 15:36:10Z mike $".
  */
--- 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: statbuf.c 5073 2006-02-04 17:39:51Z mike $"
+ * "$Id: statbuf.c 5373 2006-04-06 20:03:32Z mike $"
  *
  *   Status buffer routines for the Common UNIX Printing System (CUPS)
  *   scheduler.
@@ -317,7 +317,9 @@
   * Copy over the buffer data we've used up...
   */
 
-  _cups_strcpy(sb->buffer, lineptr);
+  if (lineptr < sb->buffer + sb->bufused)
+    _cups_strcpy(sb->buffer, lineptr);
+
   sb->bufused -= lineptr - sb->buffer;
 
   if (sb->bufused < 0)
@@ -328,5 +330,5 @@
 
 
 /*
- * End of "$Id: statbuf.c 5073 2006-02-04 17:39:51Z mike $".
+ * End of "$Id: statbuf.c 5373 2006-04-06 20:03:32Z mike $".
  */
--- 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: cert.c 5305 2006-03-18 03:05:12Z mike $"
+ * "$Id: cert.c 5381 2006-04-07 14:39:46Z mike $"
  *
  *   Authentication certificate routines for the Common UNIX
  *   Printing System (CUPS).
@@ -426,5 +426,5 @@
 
 
 /*
- * End of "$Id: cert.c 5305 2006-03-18 03:05:12Z mike $".
+ * End of "$Id: cert.c 5381 2006-04-07 14:39:46Z mike $".
  */
--- 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: dirsvc.c 5330 2006-03-23 21:07:20Z mike $"
+ * "$Id: dirsvc.c 5349 2006-03-29 15:22:10Z mike $"
  *
  *   Directory services routines for the Common UNIX Printing System (CUPS).
  *
@@ -2471,8 +2471,20 @@
 
   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));
 
  /*
   * Send a packet to each browse address...
@@ -3116,5 +3128,5 @@
 
 
 /*
- * End of "$Id: dirsvc.c 5330 2006-03-23 21:07:20Z mike $".
+ * End of "$Id: dirsvc.c 5349 2006-03-29 15:22:10Z mike $".
  */
--- 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: job.c 5305 2006-03-18 03:05:12Z mike $"
+ * "$Id: job.c 5383 2006-04-07 15:36:10Z mike $"
  *
  *   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...
   */
 
-  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;
+
+  if (job->printer)
+    oldp = job->printer;
+  else
+    oldp = cupsdFindDest(olddest);
 
  /*
   * 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: job.c 5305 2006-03-18 03:05:12Z mike $".
+ * End of "$Id: job.c 5383 2006-04-07 15:36:10Z mike $".
  */
--- 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: client.c 5335 2006-03-24 02:56:20Z mike $"
+ * "$Id: client.c 5373 2006-04-06 20:03:32Z mike $"
  *
  *   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: client.c 5335 2006-03-24 02:56:20Z mike $".
+ * End of "$Id: client.c 5373 2006-04-06 20:03:32Z mike $".
  */


Index: cups.spec
===================================================================
RCS file: /cvs/dist/rpms/cups/FC-5/cups.spec,v
retrieving revision 1.148
retrieving revision 1.149
diff -u -r1.148 -r1.149
--- cups.spec	7 Apr 2006 15:36:46 -0000	1.148
+++ cups.spec	7 Apr 2006 17:06:46 -0000	1.149
@@ -7,7 +7,7 @@
 Summary: Common Unix Printing System
 Name: cups
 Version: 1.2
-Release: 0.2.%{beta}.2.8
+Release: 0.2.%{beta}.2.9
 License: GPL
 Group: System Environment/Daemons
 Source: ftp://ftp.easysw.com/pub/cups/test/cups-1.2%{beta}-source.tar.bz2
@@ -46,6 +46,7 @@
 Patch23: cups-str1532.patch
 Patch24: cups-maxlogsize.patch
 Patch25: cups-str1533.patch
+Patch26: cups-scheduler.patch
 Patch28: cups-no-propagate-ipp-port.patch
 Patch32: cups-pid.patch
 Patch40: cups-link.patch
@@ -147,6 +148,7 @@
 %patch23 -p1 -b .str1532
 %patch24 -p1 -b .maxlogsize
 %patch25 -p1 -b .str1533
+%patch26 -p1 -b .scheduler
 %patch28 -p1 -b .no-propagate-ipp-port
 %patch32 -p1 -b .pid
 %patch40 -p1 -b .link
@@ -391,6 +393,9 @@
 %{cups_serverbin}/daemon/cups-lpd
 
 %changelog
+* Fri Apr  7 2006 Tim Waugh <twaugh at redhat.com> 1:1.2-0.2.rc1.2.9
+- Sync scheduler/* with svn 5383.
+
 * Fri Apr  7 2006 Tim Waugh <twaugh at redhat.com> 1:1.2-0.2.rc1.2.8
 - No longer need openssl-devel.
 - Build with LDAP_DEPRECATED=1, to pick up declarations of ldap_init() etc.




More information about the fedora-cvs-commits mailing list