/* 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 "proto.h" /* load section from XML file into MIME_LIST-type struct */ MIME_LIST *mime_load(MIME_LIST * mime_list, XML_LIST * xml_list) { MIME_LIST *tmp_list = mime_list; struct MIME_LIST_LIST *allow = NULL, *deny = NULL; if (tmp_list == NULL) { tmp_list = xmalloc(sizeof(MIME_LIST)); tmp_list->dtemplate = NULL; tmp_list->allow = NULL; tmp_list->deny = NULL; tmp_list->empty = NULL; tmp_list->policy = POLICY_ALLOW; tmp_list->empty = mime_ll_new(NULL); tmp_list->id = 0; tmp_list->enabled = TRUE; mime_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 = mime_ll_new(allow); allow->id = mime_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) mime_ll_insert(allow, xml_list->item, NULL, NULL, NULL, NULL); } XML_LIST_CMP(xml_list, "