usr/src/cmd/cups/Patches/07-scf-active.patch
author Cyril Plisko <cyril.plisko@grigale.com>
Sat, 22 Jan 2011 12:27:08 -0800
changeset 64 707ce1130311
parent 60 0d167ac031c9
permissions -rw-r--r--
Import sfw build 158 Bugs Fixed ---------- 6955181 memcached denial-of-service 7007860 SFW still contains multiple references to /var/svc/manifest files that got moved to /lib 7009105 OPENSSL_VERSION_NUMBER changed format breaking ON build 7009580 preparations for upgrading to a new compiler 7009623 gld fails to execute 7010920 CUPS ships /var/run in error 7011373 time to update default package copyright again

--- Makedefs.in.orig	Mon Aug 31 23:17:04 2009
+++ Makedefs.in	Mon Aug 31 23:17:04 2009
@@ -124,7 +124,7 @@
 BACKLIBS	=	@BACKLIBS@
 BANNERTOPS	=	@BANNERTOPS@
 CFLAGS		=	@CPPFLAGS@ @CFLAGS@
-COMMONLIBS	=	@LIBS@
+COMMONLIBS	=	@LIBS@ -lscf
 CUPSDLIBS	=	@CUPSDLIBS@
 CXXFLAGS	=	@CPPFLAGS@ @CXXFLAGS@
 CXXLIBS		=	@CXXLIBS@
--- cups/http.c.orig	Mon Aug  9 23:15:55 2010
+++ cups/http.c	Tue Dec  7 01:16:04 2010
@@ -396,7 +396,35 @@
   return (httpConnectEncrypt(host, port, HTTP_ENCRYPT_IF_REQUESTED));
 }
 
+/*
+ * Test to see if CUPS is the "active" print service on Solaris by looking for
+ * a special "general/active" boolean property in the CUPS service instance
+ * svc:/application/cups/scheduler:default.  If it exists and is true, CUPS
+ * is the active print service.
+ */
+#include <libscf.h>
 
+static int
+cups_is_active()
+{
+  int active = 0;
+
+  scf_simple_prop_t *prop = scf_simple_prop_get(NULL, 
+                                   "svc:/application/cups/scheduler:default",
+                                   "general", "active");
+
+  if ((prop != NULL) && (scf_simple_prop_numvalues(prop) > 0)) {
+      uint8_t *value = scf_simple_prop_next_boolean(prop);
+
+      if (value != NULL)
+      active = *value;
+    }
+
+  scf_simple_prop_free(prop);
+
+  return (active);
+}
+
 /*
  * 'httpConnectEncrypt()' - Connect to a HTTP server using encryption.
  */
@@ -460,6 +488,10 @@
   if (!host)
     return (NULL);
 
+  /* Check to see if CUPS is the "active" print service on Solaris */
+  if (cups_is_active() == 0)
+    return (NULL);
+
   httpInitialize();
 
  /*