Blame SOURCES/cups-serverbin-compat.patch

ea9550
diff -up cups-1.5b1/scheduler/conf.c.serverbin-compat cups-1.5b1/scheduler/conf.c
ea9550
--- cups-1.5b1/scheduler/conf.c.serverbin-compat	2011-05-20 06:24:54.000000000 +0200
ea9550
+++ cups-1.5b1/scheduler/conf.c	2011-05-23 17:20:33.000000000 +0200
ea9550
@@ -491,6 +491,9 @@ cupsdReadConfiguration(void)
ea9550
   cupsdClearString(&ServerName);
ea9550
   cupsdClearString(&ServerAdmin);
ea9550
   cupsdSetString(&ServerBin, CUPS_SERVERBIN);
ea9550
+#ifdef __x86_64__
ea9550
+  cupsdSetString(&ServerBin_compat, "/usr/lib64/cups");
ea9550
+#endif /* __x86_64__ */
ea9550
   cupsdSetString(&RequestRoot, CUPS_REQUESTS);
ea9550
   cupsdSetString(&CacheDir, CUPS_CACHEDIR);
ea9550
   cupsdSetString(&DataDir, CUPS_DATADIR);
ea9550
@@ -1378,7 +1381,12 @@ cupsdReadConfiguration(void)
ea9550
     * Read the MIME type and conversion database...
ea9550
     */
ea9550
 
ea9550
+#ifdef __x86_64__
ea9550
+    snprintf(temp, sizeof(temp), "%s/filter:%s/filter", ServerBin,
ea9550
+	     ServerBin_compat);
ea9550
+#else
ea9550
     snprintf(temp, sizeof(temp), "%s/filter", ServerBin);
ea9550
+#endif
ea9550
     snprintf(mimedir, sizeof(mimedir), "%s/mime", DataDir);
ea9550
 
ea9550
     MimeDatabase = mimeNew();
ea9550
diff -up cups-1.5b1/scheduler/conf.h.serverbin-compat cups-1.5b1/scheduler/conf.h
ea9550
--- cups-1.5b1/scheduler/conf.h.serverbin-compat	2011-04-22 19:47:03.000000000 +0200
ea9550
+++ cups-1.5b1/scheduler/conf.h	2011-05-23 15:34:25.000000000 +0200
ea9550
@@ -105,6 +105,10 @@ VAR char		*ConfigurationFile	VALUE(NULL)
ea9550
 					/* Root directory for scheduler */
ea9550
 			*ServerBin		VALUE(NULL),
ea9550
 					/* Root directory for binaries */
ea9550
+#ifdef __x86_64__
ea9550
+			*ServerBin_compat	VALUE(NULL),
ea9550
+					/* Compat directory for binaries */
ea9550
+#endif /* __x86_64__ */
ea9550
 			*StateDir		VALUE(NULL),
ea9550
 					/* Root directory for state data */
ea9550
 			*RequestRoot		VALUE(NULL),
ea9550
diff -up cups-1.5b1/scheduler/env.c.serverbin-compat cups-1.5b1/scheduler/env.c
ea9550
--- cups-1.5b1/scheduler/env.c.serverbin-compat	2011-01-11 04:48:42.000000000 +0100
ea9550
+++ cups-1.5b1/scheduler/env.c	2011-05-23 17:07:17.000000000 +0200
ea9550
@@ -218,8 +218,13 @@ cupsdUpdateEnv(void)
ea9550
   set_if_undefined("LD_PRELOAD", NULL);
ea9550
   set_if_undefined("NLSPATH", NULL);
ea9550
   if (find_env("PATH") < 0)
ea9550
+#ifdef __x86_64__
ea9550
+    cupsdSetEnvf("PATH", "%s/filter:%s/filter:" CUPS_BINDIR ":" CUPS_SBINDIR
ea9550
+                         ":/bin:/usr/bin", ServerBin, ServerBin_compat);
ea9550
+#else /* ! defined(__x86_64__) */
ea9550
     cupsdSetEnvf("PATH", "%s/filter:" CUPS_BINDIR ":" CUPS_SBINDIR
ea9550
 			 ":/bin:/usr/bin", ServerBin);
ea9550
+#endif
ea9550
   set_if_undefined("SERVER_ADMIN", ServerAdmin);
ea9550
   set_if_undefined("SHLIB_PATH", NULL);
ea9550
   set_if_undefined("SOFTWARE", CUPS_MINIMAL);
ea9550
diff -up cups-1.5b1/scheduler/ipp.c.serverbin-compat cups-1.5b1/scheduler/ipp.c
ea9550
--- cups-1.5b1/scheduler/ipp.c.serverbin-compat	2011-05-20 05:49:49.000000000 +0200
ea9550
+++ cups-1.5b1/scheduler/ipp.c	2011-05-23 16:09:57.000000000 +0200
ea9550
@@ -2586,9 +2586,18 @@ add_printer(cupsd_client_t  *con,	/* I -
ea9550
         * Could not find device in list!
ea9550
 	*/
ea9550
 
ea9550
+#ifdef __x86_64__
ea9550
+	snprintf(srcfile, sizeof(srcfile), "%s/backend/%s", ServerBin_compat,
ea9550
+		 scheme);
ea9550
+	if (access(srcfile, X_OK))
ea9550
+	{
ea9550
+#endif /* __x86_64__ */
ea9550
 	send_ipp_status(con, IPP_NOT_POSSIBLE,
ea9550
                         _("Bad device-uri scheme \"%s\"."), scheme);
ea9550
 	return;
ea9550
+#ifdef __x86_64__
ea9550
+	}
ea9550
+#endif /* __x86_64__ */
ea9550
       }
ea9550
     }
ea9550
 
ea9550
diff -up cups-1.5b1/scheduler/job.c.serverbin-compat cups-1.5b1/scheduler/job.c
ea9550
--- cups-1.5b1/scheduler/job.c.serverbin-compat	2011-05-20 05:49:49.000000000 +0200
ea9550
+++ cups-1.5b1/scheduler/job.c	2011-05-23 16:18:57.000000000 +0200
ea9550
@@ -1047,8 +1047,32 @@ cupsdContinueJob(cupsd_job_t *job)	/* I 
ea9550
        i ++, filter = (mime_filter_t *)cupsArrayNext(filters))
ea9550
   {
ea9550
     if (filter->filter[0] != '/')
ea9550
-      snprintf(command, sizeof(command), "%s/filter/%s", ServerBin,
ea9550
-               filter->filter);
ea9550
+      {
ea9550
+	snprintf(command, sizeof(command), "%s/filter/%s", ServerBin,
ea9550
+		 filter->filter);
ea9550
+#ifdef __x86_64__
ea9550
+	if (access(command, F_OK))
ea9550
+	  {
ea9550
+	    snprintf(command, sizeof(command), "%s/filter/%s",
ea9550
+		     ServerBin_compat, filter->filter);
ea9550
+	    if (!access(command, F_OK))
ea9550
+	      {
ea9550
+		/* Not in the correct directory, but found it in the compat
ea9550
+		 * directory.  Issue a warning. */
ea9550
+		cupsdLogMessage(CUPSD_LOG_INFO,
ea9550
+				"Filter '%s' not in %s/filter!",
ea9550
+				filter->filter, ServerBin);
ea9550
+	      }
ea9550
+	    else
ea9550
+	      {
ea9550
+		/* Not in the compat directory either; make any error
ea9550
+		 * messages use the correct directory name then. */
ea9550
+		snprintf(command, sizeof(command), "%s/filter/%s", ServerBin,
ea9550
+			 filter->filter);
ea9550
+	      }
ea9550
+	  }
ea9550
+#endif /* __x86_64__ */
ea9550
+      }
ea9550
     else
ea9550
       strlcpy(command, filter->filter, sizeof(command));
ea9550
 
ea9550
@@ -1199,6 +1223,28 @@ cupsdContinueJob(cupsd_job_t *job)	/* I 
ea9550
     {
ea9550
       cupsdClosePipe(job->back_pipes);
ea9550
       cupsdClosePipe(job->side_pipes);
ea9550
+#ifdef __x86_64__
ea9550
+      if (access(command, F_OK))
ea9550
+	{
ea9550
+	  snprintf(command, sizeof(command), "%s/backend/%s", ServerBin_compat,
ea9550
+		   scheme);
ea9550
+	  if (!access(command, F_OK))
ea9550
+	    {
ea9550
+	      /* Not in the correct directory, but we found it in the compat
ea9550
+	       * directory.  Issue a warning. */
ea9550
+	      cupsdLogMessage(CUPSD_LOG_INFO,
ea9550
+			      "Backend '%s' not in %s/backend!", scheme,
ea9550
+			      ServerBin);
ea9550
+	    }
ea9550
+	  else
ea9550
+	    {
ea9550
+	      /* Not in the compat directory either; make any error
ea9550
+		 messages use the correct directory name then. */
ea9550
+	      snprintf(command, sizeof(command), "%s/backend/%s", ServerBin,
ea9550
+		       scheme);
ea9550
+	    }
ea9550
+	}
ea9550
+#endif /* __x86_64__ */
ea9550
 
ea9550
       close(job->status_pipes[1]);
ea9550
       job->status_pipes[1] = -1;
ea9550
diff -up cups-1.5b1/scheduler/printers.c.serverbin-compat cups-1.5b1/scheduler/printers.c
ea9550
--- cups-1.5b1/scheduler/printers.c.serverbin-compat	2011-05-20 05:49:49.000000000 +0200
ea9550
+++ cups-1.5b1/scheduler/printers.c	2011-05-23 17:09:04.000000000 +0200
ea9550
@@ -1030,9 +1030,19 @@ cupsdLoadAllPrinters(void)
ea9550
 	    * Backend does not exist, stop printer...
ea9550
 	    */
ea9550
 
ea9550
+#ifdef __x86_64__
ea9550
+	    snprintf(line, sizeof(line), "%s/backend/%s", ServerBin_compat,
ea9550
+		     p->device_uri);
ea9550
+	    if (access(line, 0))
ea9550
+	      {
ea9550
+#endif /* __x86_64__ */
ea9550
+
ea9550
 	    p->state = IPP_PRINTER_STOPPED;
ea9550
 	    snprintf(p->state_message, sizeof(p->state_message),
ea9550
 	             "Backend %s does not exist!", line);
ea9550
+#ifdef __x86_64__
ea9550
+	      }
ea9550
+#endif /* __x86_64__ */
ea9550
 	  }
ea9550
         }
ea9550
 
ea9550
@@ -3621,8 +3631,20 @@ add_printer_filter(
ea9550
     else
ea9550
       snprintf(filename, sizeof(filename), "%s/filter/%s", ServerBin, program);
ea9550
 
ea9550
+#ifdef __x86_64__
ea9550
+    if (_cupsFileCheck(filename, _CUPS_FILE_CHECK_PROGRAM, !RunUser,
ea9550
+                       cupsdLogFCMessage, p) == _CUPS_FILE_CHECK_MISSING) {
ea9550
+      snprintf(filename, sizeof(filename), "%s/filter/%s", ServerBin_compat,
ea9550
+               program);
ea9550
+      if (_cupsFileCheck(filename, _CUPS_FILE_CHECK_PROGRAM, !RunUser,
ea9550
+                         cupsdLogFCMessage, p) == _CUPS_FILE_CHECK_MISSING)
ea9550
+        snprintf(filename, sizeof(filename), "%s/filter/%s", ServerBin,
ea9550
+                 program);
ea9550
+    }
ea9550
+#else /* ! defined(__x86_64__) */
ea9550
     _cupsFileCheck(filename, _CUPS_FILE_CHECK_PROGRAM, !RunUser,
ea9550
                    cupsdLogFCMessage, p);
ea9550
+#endif 
ea9550
   }
ea9550
 
ea9550
  /*