/*************************************************************************** * 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 . * ***************************************************************************/ #define authtype_builtin 0 #define authtype_radius 1 #define authtype_ldap 2 #define authtype_securid 3 struct authServerSOS { int type; // Type of Auth Server (radius (default), ldap, securid) char name[32]; // Auth Server name int id; // ID char serverName[32]; // Server Name char backup1[32]; // Backup Server Name 1 char backup2[32]; // Backup Server Name 2 int timeout; // Server timeout int forcedTimeout; // Forced Timeout char radiusSecret[32]; // Radius Secret char sourceInterface[32]; // Source Interface struct authServerSOS *next; }; // Process Auth Server void processSOSAuthServer(char *line, struct nipperConfig *nipper) { // Variables char tempString[nipper->maxSize]; struct ciscoCommand command; struct authServerSOS *authServerPointer = 0; if (nipper->debugMode == true) printf("Auth-Server Line: %s\n", line); // Init command = splitLine(line); if (strcmp(command.part[0], "set") == 0) { // Has Auth Server structure been created? if (nipper->sos->authServer == 0) { // Create nipper->sos->authServer = malloc(sizeof(struct authServerSOS)); // Init memset(nipper->sos->authServer, 0 , sizeof(struct authServerSOS)); authServerPointer = nipper->sos->authServer; authServerPointer->type = authtype_builtin; authServerPointer->timeout = 10; } // Search for server else { authServerPointer = nipper->sos->authServer; stripQuotes(command.part[2], tempString, nipper->maxSize); while ((authServerPointer->next != 0) && (strcmp(tempString, authServerPointer->name) != 0)) authServerPointer = authServerPointer->next; // If not found if (strcmp(tempString, authServerPointer->name) != 0) { // Create authServerPointer->next = malloc(sizeof(struct authServerSOS)); // Init memset(authServerPointer->next, 0 , sizeof(struct authServerSOS)); authServerPointer = authServerPointer->next; authServerPointer->type = authtype_builtin; authServerPointer->timeout = 10; } } // Set auth-server name stripQuotes(command.part[2], authServerPointer->name, sizeof(authServerPointer->name)); // Timeout if (strcmp(command.part[3], "timeout") == 0) authServerPointer->timeout = atoi(command.part[4]); // Forced Timeout else if (strcmp(command.part[3], "forced-timeout") == 0) authServerPointer->forcedTimeout = atoi(command.part[4]); // ID else if (strcmp(command.part[3], "id") == 0) authServerPointer->id = atoi(command.part[4]); // Server Name else if (strcmp(command.part[3], "server-name") == 0) stripQuotes(command.part[4], authServerPointer->serverName, sizeof(authServerPointer->serverName)); // Backup Server Name 1 else if (strcmp(command.part[3], "backup1") == 0) stripQuotes(command.part[4], authServerPointer->backup1, sizeof(authServerPointer->backup1)); // Backup Server Name 2 else if (strcmp(command.part[3], "backup2") == 0) stripQuotes(command.part[4], authServerPointer->backup2, sizeof(authServerPointer->backup2)); // Source Interface else if ((strcmp(command.part[3], "src_interface") == 0) || (strcmp(command.part[3], "src-interface") == 0)) stripQuotes(command.part[4], authServerPointer->sourceInterface, sizeof(authServerPointer->sourceInterface)); // Radius else if (strcmp(command.part[3], "radius") == 0) { authServerPointer->type = authtype_radius; // Secret if (strcmp(command.part[4], "secret") == 0) stripQuotes(command.part[5], authServerPointer->radiusSecret, sizeof(authServerPointer->radiusSecret)); } // LDAP else if (strcmp(command.part[3], "ldap") == 0) { authServerPointer->type = authtype_ldap; } // SecureID else if (strcmp(command.part[3], "securid") == 0) { authServerPointer->type = authtype_securid; } } }