1 /* @(#) $Id: active-response.c,v 1.26 2009/06/24 17:06:21 dcid Exp $ */
3 /* Copyright (C) 2009 Trend Micro Inc.
6 * This program is a free software; you can redistribute it
7 * and/or modify it under the terms of the GNU General Public
8 * License (version 3) as published by the FSF - Free Software
14 #include "active-response.h"
18 * Initializing active response.
22 ar_commands = OSList_Create();
23 active_responses = OSList_Create();
26 if(!ar_commands || !active_responses)
28 ErrorExit(LIST_ERROR, ARGV0);
33 /** int AR_ReadConfig(int test_config, char *cfgfile)
34 * Reads active response configuration and write them
35 * to the appropriate lists.
37 int AR_ReadConfig(int test_config, char *cfgfile)
45 /* Cleaning ar file */
46 fp = fopen(DEFAULTARPATH, "w");
49 merror(FOPEN_ERROR, ARGV0, DEFAULTARPATH);
52 fprintf(fp, "restart-ossec0 - restart-ossec.sh - 0\n");
53 fprintf(fp, "restart-ossec0 - restart-ossec.cmd - 0\n");
57 /* Setting right permission */
58 chmod(DEFAULTARPATH, 0444);
61 /* Reading configuration */
62 if(ReadConfig(modules, cfgfile, ar_commands, active_responses) < 0)