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
/
rootcheck
/
check_rc_if.c
diff --git
a/src/rootcheck/check_rc_if.c
b/src/rootcheck/check_rc_if.c
index
3415861
..
1d4dd62
100755
(executable)
--- a/
src/rootcheck/check_rc_if.c
+++ b/
src/rootcheck/check_rc_if.c
@@
-1,11
+1,12
@@
-/* @(#) $Id: check_rc_if.c,v 1.10 2009/06/24 18:53:07 dcid Exp $ */
+/* @(#) $Id: ./src/rootcheck/check_rc_if.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
*/
@@
-13,7
+14,7
@@
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <sys/socket.h>
-#include <sys/ioctl.h>
+#include <sys/ioctl.h>
#include <net/if.h>
#include <stdio.h>
#include <net/if.h>
#include <stdio.h>
@@
-49,9
+50,9
@@
int run_ifconfig(char *ifconfig)
if(system(nt) == 0)
return(1);
if(system(nt) == 0)
return(1);
- return(0);
+ return(0);
}
}
-
+
/* check_rc_if: v0.1
* Check all interfaces for promiscuous mode
/* check_rc_if: v0.1
* Check all interfaces for promiscuous mode
@@
-60,7
+61,7
@@
void check_rc_if()
{
int _fd, _errors = 0, _total = 0;
struct ifreq tmp_str[16];
{
int _fd, _errors = 0, _total = 0;
struct ifreq tmp_str[16];
-
+
struct ifconf _if;
struct ifreq *_ir;
struct ifreq *_ifend;
struct ifconf _if;
struct ifreq *_ir;
struct ifreq *_ifend;
@@
-73,34
+74,34
@@
void check_rc_if()
return;
}
return;
}
-
+
memset(tmp_str, 0, sizeof(struct ifreq)*16);
_if.ifc_len = sizeof(tmp_str);
_if.ifc_buf = (caddr_t)(tmp_str);
memset(tmp_str, 0, sizeof(struct ifreq)*16);
_if.ifc_len = sizeof(tmp_str);
_if.ifc_buf = (caddr_t)(tmp_str);
-
+
if (ioctl(_fd, SIOCGIFCONF, &_if) < 0)
{
close(_fd);
merror("%s: Error checking interfaces (ioctl)", ARGV0);
return;
}
if (ioctl(_fd, SIOCGIFCONF, &_if) < 0)
{
close(_fd);
merror("%s: Error checking interfaces (ioctl)", ARGV0);
return;
}
-
+
_ifend = (struct ifreq*) ((char*)tmp_str + _if.ifc_len);
_ir = tmp_str;
/* Looping on all interfaces */
_ifend = (struct ifreq*) ((char*)tmp_str + _if.ifc_len);
_ir = tmp_str;
/* Looping on all interfaces */
- for (; _ir < _ifend; _ir++)
+ for (; _ir < _ifend; _ir++)
{
strncpy(_ifr.ifr_name, _ir->ifr_name, sizeof(_ifr.ifr_name));
/* Getting information from each interface */
{
strncpy(_ifr.ifr_name, _ir->ifr_name, sizeof(_ifr.ifr_name));
/* Getting information from each interface */
- if (ioctl(_fd, SIOCGIFFLAGS, (char*)&_ifr) == -1)
+ if (ioctl(_fd, SIOCGIFFLAGS, (char*)&_ifr) == -1)
{
continue;
}
_total++;
{
continue;
}
_total++;
-
+
if ((_ifr.ifr_flags & IFF_PROMISC) )
{
if ((_ifr.ifr_flags & IFF_PROMISC) )
{
@@
-120,7
+121,7
@@
void check_rc_if()
}
_errors++;
}
}
_errors++;
}
- }
+ }
close(_fd);
if(_errors == 0)
close(_fd);
if(_errors == 0)
@@
-130,7
+131,7
@@
void check_rc_if()
" Analyzed %d interfaces.", _total);
notify_rk(ALERT_OK, op_msg);
}
" Analyzed %d interfaces.", _total);
notify_rk(ALERT_OK, op_msg);
}
-
+
return;
}
return;
}