X-Git-Url: http://ftp.carnet.hr/carnet-debian/scm?p=ossec-hids.git;a=blobdiff_plain;f=src%2Frootcheck%2Fcheck_open_ports.c;h=97091ee39b441a507bbff3133ee0ae2dd2005d94;hp=37ead353c66886c4cf6798ace12b3a2d86c69a6c;hb=6ef2f786c6c8ead94841b5f93baf9f43421f08c8;hpb=301048b51990573e58a30dc4a5bb4ec285cad554 diff --git a/src/rootcheck/check_open_ports.c b/src/rootcheck/check_open_ports.c index 37ead35..97091ee 100755 --- a/src/rootcheck/check_open_ports.c +++ b/src/rootcheck/check_open_ports.c @@ -1,4 +1,5 @@ -/* @(#) $Id$ */ +/* @(#) $Id: ./src/rootcheck/check_open_ports.c, 2011/09/08 dcid Exp $ + */ /* Copyright (C) 2009 Trend Micro Inc. * All right reserved. @@ -9,7 +10,7 @@ * Foundation */ - + #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 ossock; struct sockaddr_in server; @@ -49,10 +50,10 @@ int connect_to_port(int proto, int port) { rc = 1; } - - close(ossock); - return(rc); + close(ossock); + + return(rc); } /* try_to_access_ports */ @@ -75,7 +76,7 @@ void try_to_access_ports() 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++; } @@ -115,18 +116,18 @@ void check_open_ports() 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; - - /* 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); - + #endif return; }