Lines Matching defs:node
38 if ((cur->node->key.specified & AVTAB_TYPE) && (top != cur)) {
137 /* Create a new conditional node, optionally copying
138 * the conditional expression from an existing node.
139 * If node is NULL then a new node will be created
142 cond_node_t *cond_node_create(policydb_t * p, cond_node_t * node)
153 if (node) {
154 new_node->expr = cond_copy_expr(node->expr);
160 new_node->nbools = node->nbools;
161 for (i = 0; i < min(node->nbools, COND_MAX_BOOLS); i++)
162 new_node->bool_ids[i] = node->bool_ids[i];
163 new_node->expr_pre_comp = node->expr_pre_comp;
164 new_node->flags = node->flags;
172 * pointer to the existing node, setting 'was_created' to 0.
191 /* return either a pre-existing matching node or create a new node */
198 /* add conditional node to policy list */
305 * current state of the node it sets the rules in the true/false
309 static int evaluate_cond_node(policydb_t * p, cond_node_t * node)
314 new_state = cond_evaluate_expr(p, node->expr);
315 if (new_state != node->cur_state) {
316 node->cur_state = new_state;
320 for (cur = node->true_list; cur != NULL; cur = cur->next) {
322 cur->node->key.specified &= ~AVTAB_ENABLED;
324 cur->node->key.specified |= AVTAB_ENABLED;
328 for (cur = node->false_list; cur != NULL; cur = cur->next) {
331 cur->node->key.specified &= ~AVTAB_ENABLED;
333 cur->node->key.specified |= AVTAB_ENABLED;
382 /* free the "not" node in the list */
468 /* the avtab_ptr_t node is destroy by the avtab */
486 void cond_node_destroy(cond_node_t * node)
488 if (!node)
491 cond_expr_destroy(node->expr);
492 avrule_list_destroy(node->avtrue_list);
493 avrule_list_destroy(node->avfalse_list);
494 cond_av_list_destroy(node->true_list);
495 cond_av_list_destroy(node->false_list);
657 if (cur->node == node_ptr) {
687 list->node = node_ptr;
747 static int cond_read_node(policydb_t * p, cond_node_t * node, void *fp)
757 node->cur_state = le32_to_cpu(buf[0]);
786 node->expr = expr;
794 if (cond_read_av_list(p, fp, &node->true_list, NULL) != 0)
796 if (cond_read_av_list(p, fp, &node->false_list, node->true_list)
800 if (avrule_read_list(p, &node->avtrue_list, fp))
802 if (avrule_read_list(p, &node->avfalse_list, fp))
811 node->flags = le32_to_cpu(buf[0]);
816 cond_node_destroy(node);
817 free(node);
823 cond_node_t *node, *last = NULL;
838 node = malloc(sizeof(cond_node_t));
839 if (!node)
841 memset(node, 0, sizeof(cond_node_t));
843 if (cond_read_node(p, node, fp) != 0)
847 *list = node;
849 last->next = node;
851 last = node;
864 avtab_ptr_t node;
869 for (node = avtab_search_node(ctab, key); node != NULL;
870 node = avtab_search_node_next(node, key->specified)) {
872 (node->key.specified & (AVTAB_ALLOWED | AVTAB_ENABLED)))
873 avd->allowed |= node->datum.data;
875 (node->key.specified & (AVTAB_AUDITDENY | AVTAB_ENABLED)))
881 avd->auditdeny &= node->datum.data;
883 (node->key.specified & (AVTAB_AUDITALLOW | AVTAB_ENABLED)))
884 avd->auditallow |= node->datum.data;
897 if (cur_av->node->key.source_type == key->source_type &&
898 cur_av->node->key.target_type == key->target_type &&
899 cur_av->node->key.target_class == key->target_class)
901 return &cur_av->node->datum;