/* MiddleMan filtering proxy server Copyright (C) 2002 Jason McLaughlin This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include #include "proto.h" /* load section of xml_list into a FILTER_LIST structure */ FILTER_LIST *filter_load(FILTER_LIST * filter_list, XML_LIST * xml_list) { FILTER_LIST *tmp_list = filter_list; struct FILTER_LIST_LIST *allow = NULL, *deny = NULL; if (tmp_list == NULL) { tmp_list = xmalloc(sizeof(FILTER_LIST)); tmp_list->dtemplate = NULL; tmp_list->allow = NULL; tmp_list->deny = NULL; tmp_list->empty = NULL; tmp_list->policy = POLICY_ALLOW; tmp_list->id = 0; tmp_list->enabled = TRUE; tmp_list->empty = filter_ll_new(NULL); filter_list = tmp_list; pthread_rwlock_init(&tmp_list->lock, NULL); } else { allow = tmp_list->allow; deny = tmp_list->deny; } while ((xml_list = xml_section(xml_list, ""))) { XML_LIST_LOOP(xml_list, "") { XML_LIST_CMP(xml_list, "") { allow = filter_ll_new(allow); allow->id = filter_list->id++; if (tmp_list->allow == NULL) tmp_list->allow = allow; XML_LIST_LOOP(xml_list, "") { XML_LIST_CMP(xml_list, "") { xml_list = xml_list->next; if (xml_list->type == XML_VALUE) { if (!strcasecmp(xml_list->item, "false")) allow->enabled = FALSE; else allow->enabled = TRUE; } } XML_LIST_CMP(xml_list, "") { xml_list = xml_list->next; if (xml_list->type == XML_VALUE) filter_ll_insert(allow, xml_list->item, NULL, NULL, NULL); } XML_LIST_CMP(xml_list, "") { xml_list = xml_list->next; if (xml_list->type == XML_VALUE) filter_ll_insert(allow, NULL, xml_list->item, NULL, NULL); } XML_LIST_CMP(xml_list, "") { xml_list = xml_list->next; if (xml_list->type == XML_VALUE) filter_ll_insert(allow, NULL, NULL, xml_list->item, NULL); } XML_LIST_CMP(xml_list, "