1 /* Copyright (C) 2010 Trend Micro Inc.
4 * This program is a free software; you can redistribute it
5 * and/or modify it under the terms of the GNU General Public
6 * License (version 2) as published by the FSF - Free Software
11 #include "config/localfile-config.h"
12 #include "config/config.h"
13 #include "logcollector/logcollector.h"
16 #define ARGV0 "verify-agent-conf"
19 static void helpmsg(void) __attribute__((noreturn));
24 printf("\nOSSEC HIDS %s: Verify agent.conf syntax for errors.\n", ARGV0);
25 printf("Usage: %s [-f <agent.conf file>]\n\n", ARGV0);
26 printf("Available options:\n");
27 printf("\t-h This help message.\n");
28 printf("\t-f Full file name and path to config file to be tested.\n");
29 printf("\t If this option is not specified the following default\n");
30 printf("\t will be used.\n");
32 printf("\t Validation is successful, if no errors are shown.\n");
36 int main(int argc, char **argv)
38 const char *ar = AGENTCONFIG;
41 logreader_config log_config;
48 while ((c = getopt(argc, argv, "Vdhf:")) != -1) {
61 merror("%s: -f needs an argument", ARGV0);
73 printf("\n%s: Verifying [%s].\n\n", ARGV0, ar);
75 modules |= CLOCALFILE;
76 modules |= CAGENT_CONFIG;
77 log_config.config = NULL;
78 if (ReadConfig(modules, ar, &log_config, NULL) < 0) {