Index: root/xen-unstable.hg/tools/python/xen/util/acmpolicy.py =================================================================== --- root.orig/xen-unstable.hg/tools/python/xen/util/acmpolicy.py +++ root/xen-unstable.hg/tools/python/xen/util/acmpolicy.py @@ -49,8 +49,6 @@ ACM_SIMPLE_TYPE_ENFORCEMENT_POLICY = 2 ACM_POLICY_UNDEFINED = 15 -ACM_SCHEMA_FILE = ACM_POLICIES_DIR + "security_policy.xsd" - ACM_LABEL_UNLABELED = "__UNLABELED__" ACM_LABEL_UNLABELED_DISPLAY = "unlabeled" @@ -118,6 +116,153 @@ DEFAULT_policy = \ " \n" +\ "\n" +ACM_SCHEMA=""" + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +""" + def get_DEFAULT_policy(dom0label=""): fromnode = "" @@ -133,18 +278,7 @@ def initialize(): instdir = security.install_policy_dir_prefix DEF_policy_file = "DEFAULT-security_policy.xml" - xsd_file = "security_policy.xsd" - - files = [ xsd_file ] - for file in files: - if not os.path.isfile(policiesdir + "/" + file ): - try: - shutil.copyfile(instdir + "/" + file, - policiesdir + "/" + file) - except Exception, e: - log.info("could not copy '%s': %s" % - (file, str(e))) #Install default policy. f = open(policiesdir + "/" + DEF_policy_file, 'w') if f: @@ -219,7 +353,8 @@ class ACMPolicy(XSPolicy): log.warn("Libxml2 python-wrapper is not installed on the system.") return xsconstants.XSERR_SUCCESS try: - parserctxt = libxml2.schemaNewParserCtxt(ACM_SCHEMA_FILE) + parserctxt = libxml2.schemaNewMemParserCtxt(ACM_SCHEMA, + len(ACM_SCHEMA)) schemaparser = parserctxt.schemaParse() valid = schemaparser.schemaNewValidCtxt() doc = libxml2.parseDoc(self.toxml())