projects
/
ossec-hids.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
izmjene za lintian
[ossec-hids.git]
/
src
/
rootcheck
/
check_open_ports.c
diff --git
a/src/rootcheck/check_open_ports.c
b/src/rootcheck/check_open_ports.c
index
bbe2fc5
..
519c2c4
100755
(executable)
--- a/
src/rootcheck/check_open_ports.c
+++ b/
src/rootcheck/check_open_ports.c
@@
-1,15
+1,16
@@
-/* @(#) $Id: check_open_ports.c,v 1.8 2009/06/24 18:53:07 dcid Exp $ */
+/* @(#) $Id: ./src/rootcheck/check_open_ports.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
*/
-
+
#include "shared.h"
#include "headers/defs.h"
#include "headers/debug_op.h"
#include "shared.h"
#include "headers/defs.h"
#include "headers/debug_op.h"
@@
-25,7
+26,7
@@
char open_ports_str[OS_SIZE_1024 + 1];
int connect_to_port(int proto, int port)
{
int rc = 0;
int connect_to_port(int proto, int port)
{
int rc = 0;
-
+
int ossock;
struct sockaddr_in server;
int ossock;
struct sockaddr_in server;
@@
-39,6
+40,10
@@
int connect_to_port(int proto, int port)
if((ossock = socket(PF_INET,SOCK_STREAM,IPPROTO_TCP)) < 0)
return(0);
}
if((ossock = socket(PF_INET,SOCK_STREAM,IPPROTO_TCP)) < 0)
return(0);
}
+ else
+ {
+ return (0);
+ }
memset(&server, 0, sizeof(server));
server.sin_family = AF_INET;
memset(&server, 0, sizeof(server));
server.sin_family = AF_INET;
@@
-49,10
+54,10
@@
int connect_to_port(int proto, int port)
{
rc = 1;
}
{
rc = 1;
}
-
- close(ossock);
- return(rc);
+ close(ossock);
+
+ return(rc);
}
/* try_to_access_ports */
}
/* try_to_access_ports */
@@
-75,7
+80,7
@@
void try_to_access_ports()
snprintf(port_proto, 64, "%d (tcp),", i);
}
strncat(open_ports_str, port_proto, open_ports_size);
snprintf(port_proto, 64, "%d (tcp),", i);
}
strncat(open_ports_str, port_proto, open_ports_size);
- open_ports_size -= strlen(port_proto) +1;
+ open_ports_size -= strlen(port_proto) +1;
_ports_open++;
}
_ports_open++;
}
@@
-115,18
+120,18
@@
void check_open_ports()
memset(open_ports_str, '\0', OS_SIZE_1024 +1);
open_ports_size = OS_SIZE_1024 - 1;
_ports_open = 0;
memset(open_ports_str, '\0', OS_SIZE_1024 +1);
open_ports_size = OS_SIZE_1024 - 1;
_ports_open = 0;
-
+
#ifndef OSSECHIDS
snprintf(open_ports_str, OS_SIZE_1024, "The following ports are open:");
open_ports_size-=strlen(open_ports_str) +1;
#ifndef OSSECHIDS
snprintf(open_ports_str, OS_SIZE_1024, "The following ports are open:");
open_ports_size-=strlen(open_ports_str) +1;
-
- /* Testing All ports */
+
+ /* Testing All ports */
try_to_access_ports();
open_ports_str[strlen(open_ports_str) -1] = '\0';
notify_rk(ALERT_OK, open_ports_str);
try_to_access_ports();
open_ports_str[strlen(open_ports_str) -1] = '\0';
notify_rk(ALERT_OK, open_ports_str);
-
+
#endif
return;
}
#endif
return;
}