X-Git-Url: http://ftp.carnet.hr/carnet-debian/scm?a=blobdiff_plain;f=src%2Fos_csyslogd%2Fmain.c;h=5d110f5967fee8550c8982fb6cd2f748016aebe4;hb=280230a44cb9f9872652b6bb80de45a27af411f4;hp=1f9f420456f5be344a7cd28c13ec1e855ecb9d55;hpb=914feba5d54f979cd5d7e69c349c3d01f630042a;p=ossec-hids.git diff --git a/src/os_csyslogd/main.c b/src/os_csyslogd/main.c index 1f9f420..5d110f5 100755 --- a/src/os_csyslogd/main.c +++ b/src/os_csyslogd/main.c @@ -1,14 +1,15 @@ -/* @(#) $Id: main.c,v 1.4 2009/11/18 19:07:40 dcid Exp $ */ +/* @(#) $Id: ./src/os_csyslogd/main.c, 2011/09/08 dcid Exp $ + */ /* Copyright (C) 2009 Trend Micro Inc. * All rights reserved. * * This program is a free software; you can redistribute it * and/or modify it under the terms of the GNU General Public - * License (version 3) as published by the FSF - Free Software + * 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 */ @@ -35,7 +36,7 @@ int main(int argc, char **argv) /* Setting the name */ OS_SetName(ARGV0); - + while((c = getopt(argc, argv, "vVdhtfu:g:D:c:")) != -1){ switch(c){ @@ -44,7 +45,7 @@ int main(int argc, char **argv) break; case 'v': print_version(); - break; + break; case 'h': help(ARGV0); break; @@ -68,13 +69,14 @@ int main(int argc, char **argv) if(!optarg) ErrorExit("%s: -D needs an argument",ARGV0); dir=optarg; + break; case 'c': if(!optarg) ErrorExit("%s: -c needs an argument",ARGV0); cfg = optarg; break; case 't': - test_config = 1; + test_config = 1; break; default: help(ARGV0); @@ -116,14 +118,14 @@ int main(int argc, char **argv) if(ltmp) *ltmp = '\0'; } - + /* Exit here if test config is set */ if(test_config) exit(0); - - - if (!run_foreground) + + + if (!run_foreground) { /* Going on daemon mode */ nowDaemon(); @@ -131,7 +133,7 @@ int main(int argc, char **argv) } - + /* Not configured */ if(!syslog_config || !syslog_config[0]) { @@ -140,13 +142,13 @@ int main(int argc, char **argv) exit(0); } - + /* Privilege separation */ if(Privsep_SetGroup(gid) < 0) ErrorExit(SETGID_ERROR,ARGV0,group); - + /* chrooting */ if(Privsep_Chroot(dir) < 0) ErrorExit(CHROOT_ERROR,ARGV0,dir); @@ -156,8 +158,8 @@ int main(int argc, char **argv) nowChroot(); - - /* Changing user */ + + /* Changing user */ if(Privsep_SetUser(uid) < 0) ErrorExit(SETUID_ERROR,ARGV0,user); @@ -169,15 +171,15 @@ int main(int argc, char **argv) /* Signal manipulation */ StartSIG(ARGV0); - + /* Creating PID files */ if(CreatePID(ARGV0, getpid()) < 0) ErrorExit(PID_ERROR, ARGV0); - + /* Start up message */ verbose(STARTUP_MSG, ARGV0, (int)getpid()); - + /* the real daemon now */ OS_CSyslogD(syslog_config);