projects
/
ossec-hids.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge tag 'upstream/2.7'
[ossec-hids.git]
/
src
/
rootcheck
/
check_rc_dev.c
diff --git
a/src/rootcheck/check_rc_dev.c
b/src/rootcheck/check_rc_dev.c
index
09f6cf6
..
071b470
100755
(executable)
--- a/
src/rootcheck/check_rc_dev.c
+++ b/
src/rootcheck/check_rc_dev.c
@@
-1,4
+1,5
@@
-/* @(#) $Id$ */
+/* @(#) $Id: ./src/rootcheck/check_rc_dev.c, 2011/09/08 dcid Exp $
+ */
/* Copyright (C) 2009 Trend Micro Inc.
* All right reserved.
/* Copyright (C) 2009 Trend Micro Inc.
* All right reserved.
@@
-9,7
+10,7
@@
* Foundation
*/
* Foundation
*/
-
+
#ifndef WIN32
#include "shared.h"
#include "rootcheck.h"
#ifndef WIN32
#include "shared.h"
#include "rootcheck.h"
@@
-23,12
+24,12
@@
int read_dev_dir(char *dir_name);
int read_dev_file(char *file_name)
{
struct stat statbuf;
int read_dev_file(char *file_name)
{
struct stat statbuf;
-
+
if(lstat(file_name, &statbuf) < 0)
{
return(-1);
}
if(lstat(file_name, &statbuf) < 0)
{
return(-1);
}
-
+
if(S_ISDIR(statbuf.st_mode))
{
#ifdef DEBUG
if(S_ISDIR(statbuf.st_mode))
{
#ifdef DEBUG
@@
-37,7
+38,7
@@
int read_dev_file(char *file_name)
return(read_dev_dir(file_name));
}
return(read_dev_dir(file_name));
}
-
+
else if(S_ISREG(statbuf.st_mode))
{
char op_msg[OS_SIZE_1024 +1];
else if(S_ISREG(statbuf.st_mode))
{
char op_msg[OS_SIZE_1024 +1];
@@
-58,11
+59,11
@@
int read_dev_file(char *file_name)
int read_dev_dir(char *dir_name)
{
int i;
int read_dev_dir(char *dir_name)
{
int i;
-
+
DIR *dp;
DIR *dp;
-
+
struct dirent *entry;
struct dirent *entry;
-
+
/* when will these people learn that dev is not
* meant to store log files or other kind of texts..
*/
/* when will these people learn that dev is not
* meant to store log files or other kind of texts..
*/
@@
-70,8
+71,8
@@
int read_dev_dir(char *dir_name)
"MAKEDEV.README", ".udevdb",
".udev.tdb", ".initramfs-tools",
"MAKEDEV.local", ".udev", ".initramfs",
"MAKEDEV.README", ".udevdb",
".udev.tdb", ".initramfs-tools",
"MAKEDEV.local", ".udev", ".initramfs",
- "oprofile","fd",
- #ifdef SOLARIS
+ "oprofile","fd","cgroup",
+ #ifdef SOLARIS
".devfsadm_dev.lock",
".devlink_db_lock",
".devlink_db",
".devfsadm_dev.lock",
".devlink_db_lock",
".devlink_db",
@@
-80,22
+81,22
@@
int read_dev_dir(char *dir_name)
".devfsadm_synch_door",
".zone_reg_door",
#endif
".devfsadm_synch_door",
".zone_reg_door",
#endif
- NULL};
-
+ NULL};
+
/* Full path ignore */
char *(ignore_dev_full_path[]) = {"/dev/shm/sysconfig",
/* Full path ignore */
char *(ignore_dev_full_path[]) = {"/dev/shm/sysconfig",
- "/dev/bus/usb/.usbfs",
+ "/dev/bus/usb/.usbfs",
"/dev/shm",
"/dev/gpmctl",
NULL};
"/dev/shm",
"/dev/gpmctl",
NULL};
-
+
if((dir_name == NULL)||(strlen(dir_name) > PATH_MAX))
{
merror("%s: Invalid directory given.",ARGV0);
return(-1);
}
if((dir_name == NULL)||(strlen(dir_name) > PATH_MAX))
{
merror("%s: Invalid directory given.",ARGV0);
return(-1);
}
-
+
/* Opening the directory given */
dp = opendir(dir_name);
if(!dp)
/* Opening the directory given */
dp = opendir(dir_name);
if(!dp)
@@
-109,24
+110,24
@@
int read_dev_dir(char *dir_name)
/* Just ignore . and .. */
if((strcmp(entry->d_name,".") == 0) ||
/* Just ignore . and .. */
if((strcmp(entry->d_name,".") == 0) ||
- (strcmp(entry->d_name,"..") == 0))
+ (strcmp(entry->d_name,"..") == 0))
continue;
continue;
-
+
_dev_total++;
_dev_total++;
-
+
/* Do not look for the ignored files */
for(i = 0;ignore_dev[i] != NULL;i++)
{
if(strcmp(ignore_dev[i], entry->d_name) == 0)
break;
}
/* Do not look for the ignored files */
for(i = 0;ignore_dev[i] != NULL;i++)
{
if(strcmp(ignore_dev[i], entry->d_name) == 0)
break;
}
-
+
if(ignore_dev[i] != NULL)
continue;
if(ignore_dev[i] != NULL)
continue;
-
- f_name[PATH_MAX +1] = '\0';
+
+ f_name[PATH_MAX +1] = '\0';
snprintf(f_name, PATH_MAX +1, "%s/%s",dir_name, entry->d_name);
snprintf(f_name, PATH_MAX +1, "%s/%s",dir_name, entry->d_name);
-
+
/* Do not look for the full ignored files */
for(i = 0;ignore_dev_full_path[i] != NULL;i++)
/* Do not look for the full ignored files */
for(i = 0;ignore_dev_full_path[i] != NULL;i++)
@@
-135,20
+136,20
@@
int read_dev_dir(char *dir_name)
break;
}
break;
}
-
+
/* Checking against the full path. */
if(ignore_dev_full_path[i] != NULL)
{
continue;
}
/* Checking against the full path. */
if(ignore_dev_full_path[i] != NULL)
{
continue;
}
-
+
read_dev_file(f_name);
}
closedir(dp);
read_dev_file(f_name);
}
closedir(dp);
-
+
return(0);
}
return(0);
}
@@
-159,7
+160,7
@@
int read_dev_dir(char *dir_name)
void check_rc_dev(char *basedir)
{
char file_path[OS_SIZE_1024 +1];
void check_rc_dev(char *basedir)
{
char file_path[OS_SIZE_1024 +1];
-
+
_dev_total = 0, _dev_errors = 0;
debug1("%s: DEBUG: Starting on check_rc_dev", ARGV0);
_dev_total = 0, _dev_errors = 0;
debug1("%s: DEBUG: Starting on check_rc_dev", ARGV0);
@@
-172,11
+173,11
@@
void check_rc_dev(char *basedir)
{
char op_msg[OS_SIZE_1024 +1];
snprintf(op_msg, OS_SIZE_1024, "No problem detected on the /dev "
{
char op_msg[OS_SIZE_1024 +1];
snprintf(op_msg, OS_SIZE_1024, "No problem detected on the /dev "
- "directory. Analyzed %d files",
+ "directory. Analyzed %d files",
_dev_total);
notify_rk(ALERT_OK, op_msg);
}
_dev_total);
notify_rk(ALERT_OK, op_msg);
}
-
+
return;
}
return;
}