Print this page
patch zone-auto-create-be
*** 21,30 ****
--- 21,31 ----
/*
* Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, Joyent, Inc. All rights reserved.
* Copyright 2014 Nexenta Systems, Inc. All rights reserved.
+ * Copyright 2015 Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
*/
#include <assert.h>
#include <dirent.h>
#include <errno.h>
*** 83,92 ****
--- 84,94 ----
#define DTD_ELEM_VERIFY_CFG ((const xmlChar *) "verify_cfg")
#define DTD_ELEM_VERIFY_ADM ((const xmlChar *) "verify_adm")
#define DTD_ATTR_ALLOWEXCL ((const xmlChar *) "allow-exclusive-ip")
#define DTD_ATTR_ARCH ((const xmlChar *) "arch")
+ #define DTD_ATTR_AUTO_CREATE_BE ((const xmlChar *) "auto-create-be")
#define DTD_ATTR_DIRECTORY ((const xmlChar *) "directory")
#define DTD_ATTR_IPTYPE ((const xmlChar *) "ip-type")
#define DTD_ATTR_MATCH ((const xmlChar *) "match")
#define DTD_ATTR_MODE ((const xmlChar *) "mode")
#define DTD_ATTR_NAME ((const xmlChar *) "name")
*** 97,106 ****
--- 99,109 ----
#define DTD_ATTR_SPECIAL ((const xmlChar *) "special")
#define DTD_ATTR_TARGET ((const xmlChar *) "target")
#define DTD_ATTR_TYPE ((const xmlChar *) "type")
#define DTD_ENTITY_TRUE "true"
+ #define DTD_ENTITY_FALSE "false"
static volatile boolean_t libbrand_initialized = B_FALSE;
static char i_curr_arch[MAXNAMELEN];
static char i_curr_zone[ZONENAME_MAX];
*** 752,761 ****
--- 755,792 ----
xmlFree(allow_excl);
return (ret);
}
+ boolean_t
+ brand_auto_create_be(brand_handle_t bh)
+ {
+ struct brand_handle *bhp = (struct brand_handle *)bh;
+ xmlNodePtr node;
+ xmlChar *auto_create_be;
+ boolean_t ret;
+
+ assert(bhp != NULL);
+
+ if ((node = xmlDocGetRootElement(bhp->bh_platform)) == NULL)
+ return (B_FALSE);
+
+ auto_create_be = xmlGetProp(node, DTD_ATTR_AUTO_CREATE_BE);
+ if (auto_create_be == NULL)
+ return (B_FALSE);
+
+ /* Note: only return B_FALSE if it's "false" */
+ if (strcmp((char *)auto_create_be, DTD_ENTITY_FALSE) == 0)
+ ret = B_FALSE;
+ else
+ ret = B_TRUE;
+
+ xmlFree(auto_create_be);
+
+ return (ret);
+ }
+
/*
* Iterate over brand privileges
*
* Walks the brand config, searching for <privilege> elements, calling the
* specified callback for each. Returns 0 on success, or -1 on failure.