int cil_fill_classperms(struct cil_tree_node *parse_current, struct cil_classperms **cp)
{
	int rc = SEPOL_ERR;
	enum cil_syntax syntax[] = {
		CIL_SYN_STRING,
		CIL_SYN_LIST,
		CIL_SYN_END
	};
	int syntax_len = sizeof(syntax)/sizeof(*syntax);

	rc = __cil_verify_syntax(parse_current, syntax, syntax_len);
	if (rc != SEPOL_OK) {
		goto exit;
	}

	cil_classperms_init(cp);

	(*cp)->class_str = parse_current->data;

	rc = cil_fill_perms(parse_current->next, &(*cp)->perm_strs);
	if (rc != SEPOL_OK) {
		cil_destroy_classperms(*cp);
		goto exit;
	}

	return SEPOL_OK;

exit:
	cil_log(CIL_ERR, "Bad class-permissions\n");
	*cp = NULL;
	return rc;
}
int cil_fill_classperms(struct cil_tree_node *parse_current, struct cil_classperms **cp)
{
	int rc = SEPOL_ERR;
	enum cil_syntax syntax[] = {
		CIL_SYN_STRING,
		CIL_SYN_LIST,
		CIL_SYN_END
	};
	int syntax_len = sizeof(syntax)/sizeof(*syntax);

	rc = __cil_verify_syntax(parse_current, syntax, syntax_len);
	if (rc != SEPOL_OK) {
		goto exit;
	}

	cil_classperms_init(cp);

	(*cp)->class_str = parse_current->data;

	rc = cil_fill_perms(parse_current->next, &(*cp)->perm_strs);
	if (rc != SEPOL_OK) {
		cil_destroy_classperms(*cp);
		goto exit;
	}

	return SEPOL_OK;

exit:
	cil_log(CIL_ERR, "Bad class-permissions\n");
	*cp = NULL;
	return rc;
}