X-Git-Url: http://ftp.carnet.hr/carnet-debian/scm?p=ossec-hids.git;a=blobdiff_plain;f=src%2Fsyscheckd%2Fsyscheck.c;h=d66aa109826ba70c737bb182c84887f9b67e3fea;hp=67a5879cca7ffb772d8aa0e4268e088c049f6331;hb=6ef2f786c6c8ead94841b5f93baf9f43421f08c8;hpb=301048b51990573e58a30dc4a5bb4ec285cad554 diff --git a/src/syscheckd/syscheck.c b/src/syscheckd/syscheck.c index 67a5879..d66aa10 100755 --- a/src/syscheckd/syscheck.c +++ b/src/syscheckd/syscheck.c @@ -1,4 +1,5 @@ -/* @(#) $Id$ */ +/* @(#) $Id: ./src/syscheckd/syscheck.c, 2011/09/08 dcid Exp $ + */ /* Copyright (C) 2009 Trend Micro Inc. * All rights reserved. @@ -8,7 +9,7 @@ * License (version 2) as published by the FSF - Free Software * Foundation. * - * License details at the LICENSE file included with OSSEC or + * License details at the LICENSE file included with OSSEC or * online at: http://www.ossec.net/en/licensing.html */ @@ -29,7 +30,7 @@ #include "rootcheck/rootcheck.h" -int dump_syscheck_entry(config *syscheck, char *entry, int vals, int reg); +int dump_syscheck_entry(config *syscheck, char *entry, int vals, int reg, char *restrictfile); @@ -75,7 +76,7 @@ int Start_win32_Syscheck() if(!syscheck.dir) { merror(SK_NO_DIR, ARGV0); - dump_syscheck_entry(&syscheck, "", 0, 0); + dump_syscheck_entry(&syscheck, "", 0, 0, NULL); } else if(!syscheck.dir[0]) { @@ -85,7 +86,7 @@ int Start_win32_Syscheck() if(!syscheck.registry) { - dump_syscheck_entry(&syscheck, "", 0, 1); + dump_syscheck_entry(&syscheck, "", 0, 1, NULL); } syscheck.registry[0] = NULL; @@ -107,18 +108,18 @@ int Start_win32_Syscheck() syscheck.rootcheck = 0; merror("%s: WARN: Rootcheck module disabled.", ARGV0); } - + /* Printing options */ r = 0; while(syscheck.registry[r] != NULL) { - verbose("%s: INFO: Monitoring registry entry: '%s'.", + verbose("%s: INFO: Monitoring registry entry: '%s'.", ARGV0, syscheck.registry[r]); r++; } - + r = 0; while(syscheck.dir[r] != NULL) { @@ -130,9 +131,9 @@ int Start_win32_Syscheck() /* Start up message */ verbose(STARTUP_MSG, ARGV0, getpid()); - - - + + + /* Some sync time */ sleep(syscheck.tsleep + 10); @@ -140,35 +141,35 @@ int Start_win32_Syscheck() /* Waiting if agent started properly. */ os_wait(); - + start_daemon(); exit(0); -} +} #endif /* Syscheck unix main. */ -#ifndef WIN32 +#ifndef WIN32 int main(int argc, char **argv) { int c,r; int test_config = 0,run_foreground = 0; - + char *cfg = DEFAULTCPATH; - - + + /* Zeroing the structure */ syscheck.workdir = NULL; /* Setting the name */ OS_SetName(ARGV0); - - + + while((c = getopt(argc, argv, "VtdhfD:c:")) != -1) { switch(c) @@ -197,10 +198,10 @@ int main(int argc, char **argv) break; case 't': test_config = 1; - break; + break; default: help(ARGV0); - break; + break; } } @@ -221,7 +222,7 @@ int main(int argc, char **argv) { if(!test_config) merror(SK_NO_DIR, ARGV0); - dump_syscheck_entry(&syscheck, "", 0, 0); + dump_syscheck_entry(&syscheck, "", 0, 0, NULL); } else if(!syscheck.dir[0]) { @@ -238,8 +239,8 @@ int main(int argc, char **argv) /* Reading internal options */ read_internal(); - - + + /* Rootcheck config */ if(rootcheck_init(test_config) == 0) @@ -252,30 +253,30 @@ int main(int argc, char **argv) merror("%s: WARN: Rootcheck module disabled.", ARGV0); } - + /* Exit if testing config */ if(test_config) exit(0); - + /* Setting default values */ if(syscheck.workdir == NULL) syscheck.workdir = DEFAULTDIR; - if(!run_foreground) + if(!run_foreground) { nowDaemon(); goDaemon(); } - + /* Initial time to settle */ - sleep(syscheck.tsleep + 2); - - + sleep(syscheck.tsleep + 2); + + /* Connect to the queue */ if((syscheck.queue = StartMQ(DEFAULTQPATH,WRITE)) < 0) - { + { merror(QUEUE_ERROR, ARGV0, DEFAULTQPATH, strerror(errno)); sleep(5); @@ -292,7 +293,7 @@ int main(int argc, char **argv) /* Start the signal handling */ StartSIG(ARGV0); - + /* Creating pid */ if(CreatePID(ARGV0, getpid()) < 0) @@ -336,8 +337,8 @@ int main(int argc, char **argv) } r++; } - - + + /* Some sync time */ sleep(syscheck.tsleep + 10); @@ -345,7 +346,7 @@ int main(int argc, char **argv) /* Start the daemon */ start_daemon(); - return(0); + return(0); } #endif /* ifndef WIN32 */