/*************************************************************************** * nipper - The network infrastructure parser * * Copyright (C) 2006 - 2007 by Ian Ventura-Whiting (Fizz) * * fizz@titania.co.uk * * * * 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 3 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, see . * ***************************************************************************/ void cleanupSOS(struct nipperConfig *nipper) { // Pointers struct adminUsersSOS *userSOSPointer = 0; struct authServerSOS *authServerPointer = 0; struct interfaceSOS *interfaceSOSPointer = 0; struct policySOS *policySOSPointer = 0; struct zonePolicyRuleSOS *ruleSOSPointer = 0; struct listSOS *listSOSPointer = 0; struct addressSOS *addressSOSPointer = 0; struct mappingSOS *mappingSOSPointer = 0; // Cleanup Policy while (nipper->sos->policies != 0) { // Cleanup rules while (nipper->sos->policies->policyRules != 0) { // Cleanup Source while (nipper->sos->policies->policyRules->source != 0) { listSOSPointer = nipper->sos->policies->policyRules->source->next; free (nipper->sos->policies->policyRules->source); nipper->sos->policies->policyRules->source = listSOSPointer; } // Cleanup Dest while (nipper->sos->policies->policyRules->dest != 0) { listSOSPointer = nipper->sos->policies->policyRules->dest->next; free (nipper->sos->policies->policyRules->dest); nipper->sos->policies->policyRules->dest = listSOSPointer; } // Cleanup Service while (nipper->sos->policies->policyRules->service != 0) { listSOSPointer = nipper->sos->policies->policyRules->service->next; free (nipper->sos->policies->policyRules->service); nipper->sos->policies->policyRules->service = listSOSPointer; } ruleSOSPointer = nipper->sos->policies->policyRules->next; free (nipper->sos->policies->policyRules); nipper->sos->policies->policyRules = ruleSOSPointer; } policySOSPointer = nipper->sos->policies->next; free (nipper->sos->policies); nipper->sos->policies = policySOSPointer; } // Cleanup Name List Address Mappings if (nipper->sos->nameList != 0) { // Cleanup Admin Users while (nipper->sos->nameList->mapping != 0) { mappingSOSPointer = nipper->sos->nameList->mapping->next; free(nipper->sos->nameList->mapping); nipper->sos->nameList->mapping = mappingSOSPointer; } addressSOSPointer = nipper->sos->nameList->next; free (nipper->sos->nameList); nipper->sos->nameList = addressSOSPointer; } // Cleanup admin if (nipper->sos->admin != 0) { // Cleanup Admin Users while (nipper->sos->admin->users != 0) { userSOSPointer = nipper->sos->admin->users->next; free(nipper->sos->admin->users); nipper->sos->admin->users = userSOSPointer; } free (nipper->sos->admin); // Cleanup auth server while (nipper->sos->authServer != 0) { authServerPointer = nipper->sos->authServer->next; free (nipper->sos->authServer); nipper->sos->authServer = authServerPointer; } // Cleanup Interfaces while (nipper->sos->interface != 0) { interfaceSOSPointer = nipper->sos->interface->next; free (nipper->sos->interface); nipper->sos->interface = interfaceSOSPointer; } } // Cleanup Auth Server if (nipper->sos->authServer != 0) free (nipper->sos->authServer); // Cleanup SOS config free(nipper->sos); }