1 /* @(#) $Id: ./src/win32/setup-syscheck.c, 2011/09/08 dcid Exp $
4 /* Copyright (C) 2009 Trend Micro Inc.
7 * This program is a free software; you can redistribute it
8 * and/or modify it under the terms of the GNU General Public
9 * License (version 2) as published by the FSF - Free Software
14 #include "setup-shared.h"
15 #include "os_xml/os_xml.h"
17 #define OSSEC_CONFIG_TMP ".tmp.ossec.conf"
21 int main(int argc, char **argv)
24 const char *(xml_syscheck_status[])={"ossec_config","syscheck","disabled", NULL};
28 printf("%s: Invalid syntax.\n", argv[0]);
29 printf("Try: '%s <dir> [enable|disable]'\n\n", argv[0]);
33 /* Checking for directory. */
34 if(chdir(argv[1]) != 0)
36 printf("%s: Invalid directory: '%s'.\n", argv[0], argv[1]);
41 /* Checking if ossec was installed already */
42 if(!fileexist(OSSECCONF))
44 printf("%s: OSSEC not installed yet. Exiting.\n", argv[0]);
49 /* Checking status. */
50 if(strcmp(argv[2], "enable") == 0)
60 /* Writing to the XML. */
61 if(OS_WriteXML(OSSECCONF, OSSEC_CONFIG_TMP, xml_syscheck_status,
64 printf("%s: Error writing to the Config file. Exiting.\n", argv[0]);
68 /* Renaming config files */
70 rename(OSSECCONF, OSSECLAST);
71 rename(OSSEC_CONFIG_TMP, OSSECCONF);