Skip to content

Commit

Permalink
Fix ossec-agentd comand line arguments
Browse files Browse the repository at this point in the history
Stop gap fixes to ossec-agentd for issues raised in ossec#207.

This commit makes the '-c' option work so a user can specify an alternate
configuration location.
  • Loading branch information
awiddersheim committed May 25, 2014
1 parent 77bde77 commit 40cd221
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions src/client-agent/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ int main(int argc, char **argv)
char *dir = DEFAULTDIR;
char *user = USER;
char *group = GROUPGLOBAL;
char *xmlcfg = DEFAULTCPATH;

int uid = 0;
int gid = 0;
Expand All @@ -51,7 +52,7 @@ int main(int argc, char **argv)
OS_SetName(ARGV0);


while((c = getopt(argc, argv, "Vtdfhu:g:D:")) != -1){
while((c = getopt(argc, argv, "Vtdfhu:g:D:c:")) != -1){
switch(c){
case 'V':
print_version();
Expand All @@ -76,14 +77,19 @@ int main(int argc, char **argv)
ErrorExit("%s: -g needs an argument",ARGV0);
group = optarg;
break;
case 't':
test_config = 1;
break;
case 'D':
if(!optarg)
ErrorExit("%s: -D needs an argument",ARGV0);
dir = optarg;
break;
case 'c':
if(!optarg)
ErrorExit("%s: -c needs an argument.",ARGV0);
xmlcfg = optarg;
break;
case 't':
test_config = 1;
break;
}
}

Expand Down Expand Up @@ -113,7 +119,7 @@ int main(int argc, char **argv)


/* Reading config */
if(ClientConf(DEFAULTCPATH) < 0)
if(ClientConf(xmlcfg) < 0)
{
ErrorExit(CLIENT_ERROR,ARGV0);
}
Expand Down

0 comments on commit 40cd221

Please sign in to comment.