components/cups/patches/07-scf-active.patch
changeset 481 9ca5b97b5b08
parent 480 e031a1a0c3a1
child 482 be3d0ad01572
equal deleted inserted replaced
480:e031a1a0c3a1 481:9ca5b97b5b08
     1 --- Makedefs.in.orig	Mon Aug 31 23:17:04 2009
       
     2 +++ Makedefs.in	Mon Aug 31 23:17:04 2009
       
     3 @@ -124,7 +124,7 @@
       
     4  BACKLIBS	=	@BACKLIBS@
       
     5  BANNERTOPS	=	@BANNERTOPS@
       
     6  CFLAGS		=	@CPPFLAGS@ @CFLAGS@
       
     7 -COMMONLIBS	=	@LIBS@
       
     8 +COMMONLIBS	=	@LIBS@ -lscf
       
     9  CUPSDLIBS	=	@CUPSDLIBS@
       
    10  CXXFLAGS	=	@CPPFLAGS@ @CXXFLAGS@
       
    11  CXXLIBS		=	@CXXLIBS@
       
    12 --- cups/http.c.orig	Mon Aug  9 23:15:55 2010
       
    13 +++ cups/http.c	Tue Dec  7 01:16:04 2010
       
    14 @@ -396,7 +396,35 @@
       
    15    return (httpConnectEncrypt(host, port, HTTP_ENCRYPT_IF_REQUESTED));
       
    16  }
       
    17  
       
    18 +/*
       
    19 + * Test to see if CUPS is the "active" print service on Solaris by looking for
       
    20 + * a special "general/active" boolean property in the CUPS service instance
       
    21 + * svc:/application/cups/scheduler:default.  If it exists and is true, CUPS
       
    22 + * is the active print service.
       
    23 + */
       
    24 +#include <libscf.h>
       
    25  
       
    26 +static int
       
    27 +cups_is_active()
       
    28 +{
       
    29 +  int active = 0;
       
    30 +
       
    31 +  scf_simple_prop_t *prop = scf_simple_prop_get(NULL, 
       
    32 +                                   "svc:/application/cups/scheduler:default",
       
    33 +                                   "general", "active");
       
    34 +
       
    35 +  if ((prop != NULL) && (scf_simple_prop_numvalues(prop) > 0)) {
       
    36 +      uint8_t *value = scf_simple_prop_next_boolean(prop);
       
    37 +
       
    38 +      if (value != NULL)
       
    39 +      active = *value;
       
    40 +    }
       
    41 +
       
    42 +  scf_simple_prop_free(prop);
       
    43 +
       
    44 +  return (active);
       
    45 +}
       
    46 +
       
    47  /*
       
    48   * 'httpConnectEncrypt()' - Connect to a HTTP server using encryption.
       
    49   */
       
    50 @@ -460,6 +488,10 @@
       
    51    if (!host)
       
    52      return (NULL);
       
    53  
       
    54 +  /* Check to see if CUPS is the "active" print service on Solaris */
       
    55 +  if (cups_is_active() == 0)
       
    56 +    return (NULL);
       
    57 +
       
    58    httpInitialize();
       
    59  
       
    60   /*