projects
/
ossec-hids.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
dodan override za lintian
[ossec-hids.git]
/
src
/
util
/
rootcheck_control.c
diff --git
a/src/util/rootcheck_control.c
b/src/util/rootcheck_control.c
index
5387914
..
dc1c62f
100755
(executable)
--- a/
src/util/rootcheck_control.c
+++ b/
src/util/rootcheck_control.c
@@
-1,11
+1,12
@@
-/* @(#) $Id: rootcheck_control.c,v 1.5 2009/06/24 18:53:09 dcid Exp $ */
+/* @(#) $Id: ./src/util/rootcheck_control.c, 2011/09/08 dcid Exp $
+ */
/* Copyright (C) 2009 Trend Micro Inc.
* All right reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
/* Copyright (C) 2009 Trend Micro Inc.
* All right 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
*/
* Foundation
*/
@@
-21,7
+22,7
@@
/** help **/
void helpmsg()
{
/** help **/
void helpmsg()
{
- printf("\nOSSEC HIDS %s: Manages the policy and auditing database.\n",
+ printf("\nOSSEC HIDS %s: Manages the policy and auditing database.\n",
ARGV0);
printf("Available options:\n");
printf("\t-h This help message.\n");
ARGV0);
printf("Available options:\n");
printf("\t-h This help message.\n");
@@
-54,13
+55,13
@@
int main(int argc, char **argv)
int active_only = 0, csv_output = 0;
char shost[512];
int active_only = 0, csv_output = 0;
char shost[512];
-
-
-
+
+
+
/* Setting the name */
OS_SetName(ARGV0);
/* Setting the name */
OS_SetName(ARGV0);
-
-
+
+
/* user arguments */
if(argc < 2)
{
/* user arguments */
if(argc < 2)
{
@@
-84,17
+85,17
@@
int main(int argc, char **argv)
list_agents++;
break;
case 's':
list_agents++;
break;
case 's':
- csv_output = 1;
+ csv_output = 1;
break;
case 'c':
active_only++;
break;
case 'c':
active_only++;
- break;
+ break;
case 'r':
resolved_only = 1;
case 'r':
resolved_only = 1;
- break;
+ break;
case 'q':
resolved_only = 2;
case 'q':
resolved_only = 2;
- break;
+ break;
case 'L':
show_last = 1;
break;
case 'L':
show_last = 1;
break;
@@
-122,8
+123,8
@@
int main(int argc, char **argv)
}
}
}
}
-
-
+
+
/* Getting the group name */
gid = Privsep_GetGroup(group);
uid = Privsep_GetUser(user);
/* Getting the group name */
gid = Privsep_GetGroup(group);
uid = Privsep_GetUser(user);
@@
-132,14
+133,14
@@
int main(int argc, char **argv)
ErrorExit(USER_ERROR, ARGV0, user, group);
}
ErrorExit(USER_ERROR, ARGV0, user, group);
}
-
+
/* Setting the group */
if(Privsep_SetGroup(gid) < 0)
{
ErrorExit(SETGID_ERROR,ARGV0, group);
}
/* Setting the group */
if(Privsep_SetGroup(gid) < 0)
{
ErrorExit(SETGID_ERROR,ARGV0, group);
}
-
-
+
+
/* Chrooting to the default directory */
if(Privsep_Chroot(dir) < 0)
{
/* Chrooting to the default directory */
if(Privsep_Chroot(dir) < 0)
{
@@
-149,7
+150,7
@@
int main(int argc, char **argv)
/* Inside chroot now */
nowChroot();
/* Inside chroot now */
nowChroot();
-
+
/* Setting the user */
if(Privsep_SetUser(uid) < 0)
/* Setting the user */
if(Privsep_SetUser(uid) < 0)
@@
-168,13
+169,13
@@
int main(int argc, char **argv)
}
}
-
+
/* Listing available agents. */
if(list_agents)
{
if(!csv_output)
{
/* Listing available agents. */
if(list_agents)
{
if(!csv_output)
{
- printf("\nOSSEC HIDS %s. List of available agents:",
+ printf("\nOSSEC HIDS %s. List of available agents:",
ARGV0);
printf("\n ID: 000, Name: %s (server), IP: 127.0.0.1, "
"Active/Local\n", shost);
ARGV0);
printf("\n ID: 000, Name: %s (server), IP: 127.0.0.1, "
"Active/Local\n", shost);
@@
-187,7
+188,7
@@
int main(int argc, char **argv)
printf("\n");
exit(0);
}
printf("\n");
exit(0);
}
-
+
/* Update rootcheck database. */
/* Update rootcheck database. */
@@
-217,7
+218,7
@@
int main(int argc, char **argv)
continue;
}
continue;
}
- snprintf(full_path, OS_MAXSTR,"%s/%s", ROOTCHECK_DIR,
+ snprintf(full_path, OS_MAXSTR,"%s/%s", ROOTCHECK_DIR,
entry->d_name);
fp = fopen(full_path, "w");
entry->d_name);
fp = fopen(full_path, "w");
@@
-236,7
+237,7
@@
int main(int argc, char **argv)
exit(0);
}
exit(0);
}
- else if((strcmp(agent_id, "000") == 0) ||
+ else if((strcmp(agent_id, "000") == 0) ||
(strcmp(agent_id, "local") == 0))
{
char final_dir[1024];
(strcmp(agent_id, "local") == 0))
{
char final_dir[1024];
@@
-277,7
+278,7
@@
int main(int argc, char **argv)
}
}
}
}
-
+
/* Printing information from an agent. */
if(info_agent)
{
/* Printing information from an agent. */
if(info_agent)
{
@@
-293,9
+294,9
@@
int main(int argc, char **argv)
if(!csv_output)
printf("\nPolicy and auditing events for local system '%s - %s':\n",
shost, "127.0.0.1");
if(!csv_output)
printf("\nPolicy and auditing events for local system '%s - %s':\n",
shost, "127.0.0.1");
-
+
print_rootcheck(NULL,
print_rootcheck(NULL,
- NULL, NULL, resolved_only, csv_output, show_last);
+ NULL, NULL, resolved_only, csv_output, show_last);
}
else
{
}
else
{
@@
-312,7
+313,7
@@
int main(int argc, char **argv)
/* Getting netmask from ip. */
final_ip[128] = '\0';
final_mask[128] = '\0';
/* Getting netmask from ip. */
final_ip[128] = '\0';
final_mask[128] = '\0';
- getNetmask(keys.keyentries[i]->ip->netmask,
+ getNetmask(keys.keyentries[i]->ip->netmask,
final_mask, 128);
snprintf(final_ip, 128, "%s%s",keys.keyentries[i]->ip->ip,
final_mask);
final_mask, 128);
snprintf(final_ip, 128, "%s%s",keys.keyentries[i]->ip->ip,
final_mask);
@@
-320,20
+321,20
@@
int main(int argc, char **argv)
if(!csv_output)
printf("\nPolicy and auditing events for agent "
"'%s (%s) - %s':\n",
if(!csv_output)
printf("\nPolicy and auditing events for agent "
"'%s (%s) - %s':\n",
- keys.keyentries[i]->name, keys.keyentries[i]->id,
+ keys.keyentries[i]->name, keys.keyentries[i]->id,
final_ip);
print_rootcheck(keys.keyentries[i]->name,
final_ip);
print_rootcheck(keys.keyentries[i]->name,
- keys.keyentries[i]->ip->ip, NULL,
+ keys.keyentries[i]->ip->ip, NULL,
resolved_only, csv_output, show_last);
}
resolved_only, csv_output, show_last);
}
-
+
exit(0);
}
exit(0);
}
-
+
printf("\n** Invalid argument combination.\n");
helpmsg();
printf("\n** Invalid argument combination.\n");
helpmsg();