| 110 | } |
| 111 | |
| 112 | int Governance::load(const SSL::SignedDocument& doc) |
| 113 | { |
| 114 | const std::string& xml = doc.content(); |
| 115 | ParserPtr parser; |
| 116 | if (!get_parser(parser, doc.filename(), xml)) { |
| 117 | if (security_debug.access_error) { |
| 118 | ACE_ERROR((LM_ERROR, "(%P|%t) ERROR: {access_error} Governance::load: " |
| 119 | "get_parser failed\n")); |
| 120 | } |
| 121 | return -1; |
| 122 | } |
| 123 | |
| 124 | // Find the domain rules |
| 125 | const xercesc::DOMNodeList* const domainRules = parser->getDocument()->getDocumentElement()-> |
| 126 | getElementsByTagName(XStr(ACE_TEXT("domain_rule"))); |
| 127 | for (XMLSize_t r = 0, dr_len = domainRules->getLength(); r < dr_len; ++r) { |
| 128 | Governance::DomainRule domain_rule; |
| 129 | domain_rule.domain_attrs.plugin_participant_attributes = 0; |
| 130 | const xercesc::DOMElement* const domain_rule_el = |
| 131 | dynamic_cast<const xercesc::DOMElement*>(domainRules->item(r)); |
| 132 | if (!domain_rule_el) { |
| 133 | if (security_debug.access_error) { |
| 134 | ACE_ERROR((LM_ERROR, "(%P|%t) ERROR: {access_error} Governance::load: " |
| 135 | "domain_rule_el is null\n")); |
| 136 | } |
| 137 | return -1; |
| 138 | } |
| 139 | |
| 140 | // Process domain ids this domain rule applies to |
| 141 | const xercesc::DOMNodeList* const ruleNodes = domain_rule_el->getChildNodes(); |
| 142 | for (XMLSize_t rn = 0, rn_len = ruleNodes->getLength(); rn < rn_len; rn++) { |
| 143 | const xercesc::DOMNode* const ruleNode = ruleNodes->item(rn); |
| 144 | const XStr dn_tag = ruleNode->getNodeName(); |
| 145 | if (ACE_TEXT("domains") == dn_tag) { |
| 146 | if (!parse_domain_id_set(ruleNode, domain_rule.domains)) { |
| 147 | if (security_debug.access_error) { |
| 148 | ACE_ERROR((LM_ERROR, "(%P|%t) ERROR: {access_error} Governance::load: " |
| 149 | "failed to process domain ids in \"%C\"\n", |
| 150 | doc.filename().c_str())); |
| 151 | } |
| 152 | return -1; |
| 153 | } |
| 154 | } |
| 155 | } |
| 156 | |
| 157 | // Process allow_unauthenticated_participants |
| 158 | if (!get_bool_tag(doc, domain_rule_el, ACE_TEXT("allow_unauthenticated_participants"), |
| 159 | domain_rule.domain_attrs.allow_unauthenticated_participants)) { |
| 160 | return -1; |
| 161 | } |
| 162 | |
| 163 | // Process enable_join_access_control |
| 164 | if (!get_bool_tag(doc, domain_rule_el, ACE_TEXT("enable_join_access_control"), |
| 165 | domain_rule.domain_attrs.is_access_protected)) { |
| 166 | return -1; |
| 167 | } |
| 168 | |
| 169 | // Process discovery_protection_kind |
nothing calls this directly
no test coverage detected