Print this page
7851 svccfg restore chokes on services with more than one manpage


   6  * You may not use this file except in compliance with the License.
   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 /*
  22  * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
  23  */
  24 /*
  25  * Copyright 2011 Nexenta Systems, Inc.  All rights reserved.

  26  */
  27 
  28 
  29 /*
  30  * XML document manipulation routines
  31  *
  32  * These routines provide translation to and from the internal representation to
  33  * XML.  Directionally-oriented verbs are with respect to the external source,
  34  * so lxml_get_service() fetches a service from the XML file into the
  35  * internal representation.
  36  */
  37 
  38 #include <libxml/parser.h>
  39 #include <libxml/xinclude.h>
  40 
  41 #include <assert.h>
  42 #include <ctype.h>
  43 #include <errno.h>
  44 #include <libintl.h>
  45 #include <libscf.h>


 400         xmlFree(val);
 401         p = internal_property_create(pname, SCF_TYPE_BOOLEAN, 1, bool);
 402         r = internal_attach_property(pgrp, p);
 403 
 404         if (r != 0)
 405                 internal_property_free(p);
 406 
 407         return (r);
 408 }
 409 
 410 static int
 411 new_str_prop_from_attr(pgroup_t *pgrp, const char *pname, scf_type_t ty,
 412     xmlNodePtr n, const char *attr)
 413 {
 414         xmlChar *val;
 415         property_t *p;
 416         int r;
 417 
 418         val = xmlGetProp(n, (xmlChar *)attr);
 419 










 420         p = internal_property_create(pname, ty, 1, val);
 421         r = internal_attach_property(pgrp, p);
 422 
 423         if (r != 0)
 424                 internal_property_free(p);
 425 
 426         return (r);
 427 }
 428 
 429 static int
 430 new_opt_str_prop_from_attr(pgroup_t *pgrp, const char *pname, scf_type_t ty,
 431     xmlNodePtr n, const char *attr, const char *dflt)
 432 {
 433         xmlChar *val;
 434         property_t *p;
 435         int r;
 436 
 437         val = xmlGetProp(n, (xmlChar *)attr);
 438         if (val == NULL) {
 439                 if (dflt == NULL) {




   6  * You may not use this file except in compliance with the License.
   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 /*
  22  * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
  23  */
  24 /*
  25  * Copyright 2011 Nexenta Systems, Inc.  All rights reserved.
  26  * Copyright 2017 RackTop Systems.
  27  */
  28 
  29 
  30 /*
  31  * XML document manipulation routines
  32  *
  33  * These routines provide translation to and from the internal representation to
  34  * XML.  Directionally-oriented verbs are with respect to the external source,
  35  * so lxml_get_service() fetches a service from the XML file into the
  36  * internal representation.
  37  */
  38 
  39 #include <libxml/parser.h>
  40 #include <libxml/xinclude.h>
  41 
  42 #include <assert.h>
  43 #include <ctype.h>
  44 #include <errno.h>
  45 #include <libintl.h>
  46 #include <libscf.h>


 401         xmlFree(val);
 402         p = internal_property_create(pname, SCF_TYPE_BOOLEAN, 1, bool);
 403         r = internal_attach_property(pgrp, p);
 404 
 405         if (r != 0)
 406                 internal_property_free(p);
 407 
 408         return (r);
 409 }
 410 
 411 static int
 412 new_str_prop_from_attr(pgroup_t *pgrp, const char *pname, scf_type_t ty,
 413     xmlNodePtr n, const char *attr)
 414 {
 415         xmlChar *val;
 416         property_t *p;
 417         int r;
 418 
 419         val = xmlGetProp(n, (xmlChar *)attr);
 420 
 421         /* Some properties may have multiple values. */
 422         p = internal_property_find(pgrp, pname);
 423         if (p != NULL) {
 424                 value_t *v = internal_value_new();
 425                 v->sc_u.sc_string = (char *)val;
 426                 v->sc_type = ty;
 427                 internal_attach_value(p, v);
 428                 return (0);
 429         }
 430 
 431         p = internal_property_create(pname, ty, 1, val);
 432         r = internal_attach_property(pgrp, p);
 433 
 434         if (r != 0)
 435                 internal_property_free(p);
 436 
 437         return (r);
 438 }
 439 
 440 static int
 441 new_opt_str_prop_from_attr(pgroup_t *pgrp, const char *pname, scf_type_t ty,
 442     xmlNodePtr n, const char *attr, const char *dflt)
 443 {
 444         xmlChar *val;
 445         property_t *p;
 446         int r;
 447 
 448         val = xmlGetProp(n, (xmlChar *)attr);
 449         if (val == NULL) {
 450                 if (dflt == NULL) {