projects
/
ossec-hids.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Imported Upstream version 2.7
[ossec-hids.git]
/
src
/
agentlessd
/
main.c
diff --git
a/src/agentlessd/main.c
b/src/agentlessd/main.c
index
f970cc5
..
1d3ce3b
100755
(executable)
--- a/
src/agentlessd/main.c
+++ b/
src/agentlessd/main.c
@@
-1,4
+1,5
@@
-/* @(#) $Id$ */
+/* @(#) $Id: ./src/agentlessd/main.c, 2011/09/08 dcid Exp $
+ */
/* Copyright (C) 2009 Trend Micro Inc.
* All rights reserved.
/* Copyright (C) 2009 Trend Micro Inc.
* All rights reserved.
@@
-28,7
+29,7
@@
int main(int argc, char **argv)
/* Setting the name */
OS_SetName(ARGV0);
/* Setting the name */
OS_SetName(ARGV0);
-
+
while((c = getopt(argc, argv, "Vdhtfu:g:D:c:")) != -1){
switch(c){
while((c = getopt(argc, argv, "Vdhtfu:g:D:c:")) != -1){
switch(c){
@@
-58,13
+59,14
@@
int main(int argc, char **argv)
if(!optarg)
ErrorExit("%s: -D needs an argument",ARGV0);
dir=optarg;
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':
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);
break;
default:
help(ARGV0);
@@
-101,30
+103,30
@@
int main(int argc, char **argv)
if(test_config)
exit(0);
if(test_config)
exit(0);
-
+
/* Going on daemon mode */
/* Going on daemon mode */
- if(!run_foreground)
+ if(!run_foreground)
{
nowDaemon();
goDaemonLight();
}
chdir(dir);
{
nowDaemon();
goDaemonLight();
}
chdir(dir);
-
+
/* Exiting if not configured. */
if(!lessdc.entries)
{
verbose("%s: INFO: Not configured. Exiting.", ARGV0);
exit(0);
}
/* Exiting if not configured. */
if(!lessdc.entries)
{
verbose("%s: INFO: Not configured. Exiting.", ARGV0);
exit(0);
}
-
-
+
+
/* Privilege separation */
if(Privsep_SetGroup(gid) < 0)
ErrorExit(SETGID_ERROR,ARGV0,group);
/* Privilege separation */
if(Privsep_SetGroup(gid) < 0)
ErrorExit(SETGID_ERROR,ARGV0,group);
-
- /* Changing user */
+
+ /* Changing user */
if(Privsep_SetUser(uid) < 0)
ErrorExit(SETUID_ERROR,ARGV0,user);
if(Privsep_SetUser(uid) < 0)
ErrorExit(SETUID_ERROR,ARGV0,user);
@@
-136,16
+138,16
@@
int main(int argc, char **argv)
/* Signal manipulation */
StartSIG(ARGV0);
/* Signal manipulation */
StartSIG(ARGV0);
-
+
/* Creating PID files */
if(CreatePID(ARGV0, getpid()) < 0)
ErrorExit(PID_ERROR,ARGV0);
/* Creating PID files */
if(CreatePID(ARGV0, getpid()) < 0)
ErrorExit(PID_ERROR,ARGV0);
-
+
/* Start up message */
verbose(STARTUP_MSG, ARGV0, (int)getpid());
/* Start up message */
verbose(STARTUP_MSG, ARGV0, (int)getpid());
-
+
/* the real daemon now */
Agentlessd();
/* the real daemon now */
Agentlessd();