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"
16 #include "os_xml/os_xml_writer.h"
18 #define OSSEC_CONFIG_TMP ".tmp.ossec.conf"
22 int main(int argc, char **argv)
25 char *(xml_syscheck_status[])={"ossec_config","syscheck","disabled", NULL};
29 printf("%s: Invalid syntax.\n", argv[0]);
30 printf("Try: '%s <dir> [enable|disable]'\n\n", argv[0]);
34 /* Checking for directory. */
35 if(chdir(argv[1]) != 0)
37 printf("%s: Invalid directory: '%s'.\n", argv[0], argv[1]);
42 /* Checking if ossec was installed already */
43 if(!fileexist(OSSECCONF))
45 printf("%s: OSSEC not installed yet. Exiting.\n", argv[0]);
50 /* Checking status. */
51 if(strcmp(argv[2], "enable") == 0)
61 /* Writing to the XML. */
62 if(OS_WriteXML(OSSECCONF, OSSEC_CONFIG_TMP, xml_syscheck_status,
63 NULL, "no", status, 0) != 0)
65 printf("%s: Error writing to the Config file. Exiting.\n", argv[0]);
69 /* Renaming config files */
71 rename(OSSECCONF, OSSECLAST);
72 rename(OSSEC_CONFIG_TMP, OSSECCONF);