mirror of
https://github.com/genodelabs/genode.git
synced 2024-12-19 05:37:54 +00:00
Improve robustness of policy matching
The 'Session_policy' helper could not cope well with configurations that contain nodes of a type other than '<policy>'. This patch improves the policy matching by skipping non-policy nodes.
This commit is contained in:
parent
293b3c80d2
commit
f0fcf084d7
@ -54,8 +54,12 @@ namespace Genode {
|
||||
int best_match = -1;
|
||||
try {
|
||||
unsigned label_len = 0;
|
||||
Xml_node policy = config()->xml_node().sub_node("policy");
|
||||
for (int i = 0;; i++, policy = policy.next("policy")) {
|
||||
Xml_node policy = config()->xml_node().sub_node();
|
||||
|
||||
for (int i = 0;; i++, policy = policy.next()) {
|
||||
|
||||
if (!policy.has_type("policy"))
|
||||
continue;
|
||||
|
||||
/* label attribtute from policy node */
|
||||
char policy_label[LABEL_LEN];
|
||||
@ -63,7 +67,8 @@ namespace Genode {
|
||||
sizeof(policy_label));
|
||||
|
||||
if (!_label_matches(session_label, policy_label)
|
||||
|| strlen(policy_label) < label_len) continue;
|
||||
|| strlen(policy_label) < label_len)
|
||||
continue;
|
||||
|
||||
label_len = strlen(policy_label);
|
||||
best_match = i;
|
||||
|
Loading…
Reference in New Issue
Block a user