if (avtab_read_item(fp, &datum, &key)) goto err;  /* * For type rules we have to make certain there aren't any * conflicting rules by searching the te_avtab and the * cond_te_avtab. */ if (datum.specified & AVTAB_TYPE) { if (avtab_search(&p->te_avtab, &key, AVTAB_TYPE)) { printk("security: type rule already exists outside of a conditional."); goto err; } /* * If we are reading the false list other will be a pointer to * the true list. We can have duplicate entries if there is only * 1 other entry and it is in our true list. * * If we are reading the true list (other == NULL) there shouldn't * be any other entries. */ if (other) { node_ptr = avtab_search_node(&p->te_cond_avtab, &key, AVTAB_TYPE); if (node_ptr) { if (avtab_search_node_next(node_ptr, AVTAB_TYPE)) { printk("security: too many conflicting type rules."); goto err; } found = 0; for (cur = other; cur != NULL; cur = cur->next) { if (cur->node == node_ptr) { found = 1; break; } } if (!found) { printk("security: conflicting type rules."); goto err; } } } else { if (avtab_search(&p->te_cond_avtab, &key, AVTAB_TYPE)) { printk("security: conflicting type rules when adding type rule for true."); goto err; } } } node_ptr = avtab_insert_nonunique(&p->te_cond_avtab, &key, &datum); if (!node_ptr) { printk("security: could not insert rule."); goto err; }  list = kmalloc(sizeof(struct cond_av_list), GFP_KERNEL); if (!list) goto err; memset(list, 0, sizeof(struct cond_av_list));  list->node = node_ptr; if (i == 0) *ret_list = list; else last->next = list; last = list; 
rc = avtab_read_item(fp, p->policyvers, &p->te_cond_avtab, cond_insertf, &data); if (rc) return rc; 
static int cond_read_av_list(struct policydb *p, void *fp, struct cond_av_list **ret_list,			     struct cond_av_list *other){	struct cond_av_list *list, *last = NULL, *cur;	struct avtab_key key;	struct avtab_datum datum;	struct avtab_node *node_ptr;	int rc;	u32 buf[1], i, len;	u8 found;	*ret_list = NULL;	len = 0;	rc = next_entry(buf, fp, sizeof buf);	if (rc < 0)		return -1;	len = le32_to_cpu(buf[0]);	if (len == 0) {		return 0;	}	for (i = 0; i < len; i++) {		if (avtab_read_item(fp, &datum, &key))			goto err;		/*		 * For type rules we have to make certain there aren't any		 * conflicting rules by searching the te_avtab and the		 * cond_te_avtab.		 */		if (datum.specified & AVTAB_TYPE) {			if (avtab_search(&p->te_avtab, &key, AVTAB_TYPE)) {				printk("security: type rule already exists outside of a conditional.");				goto err;			}			/*			 * If we are reading the false list other will be a pointer to			 * the true list. We can have duplicate entries if there is only			 * 1 other entry and it is in our true list.			 *			 * If we are reading the true list (other == NULL) there shouldn't			 * be any other entries.			 */			if (other) {				node_ptr = avtab_search_node(&p->te_cond_avtab, &key, AVTAB_TYPE);				if (node_ptr) {					if (avtab_search_node_next(node_ptr, AVTAB_TYPE)) {						printk("security: too many conflicting type rules.");						goto err;					}					found = 0;					for (cur = other; cur != NULL; cur = cur->next) {						if (cur->node == node_ptr) {							found = 1;							break;						}					}					if (!found) {						printk("security: conflicting type rules.");						goto err;					}				}			} else {				if (avtab_search(&p->te_cond_avtab, &key, AVTAB_TYPE)) {					printk("security: conflicting type rules when adding type rule for true.");					goto err;				}			}		}		node_ptr = avtab_insert_nonunique(&p->te_cond_avtab, &key, &datum);		if (!node_ptr) {			printk("security: could not insert rule.");			goto err;		}		list = kmalloc(sizeof(struct cond_av_list), GFP_KERNEL);		if (!list)			goto err;		memset(list, 0, sizeof(struct cond_av_list));		list->node = node_ptr;		if (i == 0)			*ret_list = list;		else			last->next = list;		last = list;	}	return 0;err:	cond_av_list_destroy(*ret_list);	*ret_list = NULL;	return -1;}
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/782ebb992ec20b5afdd5786ee8c2f1b58b631f24/conditional.c/clean/security/selinux/ss/conditional.c