X-Git-Url: http://ftp.carnet.hr/carnet-debian/scm?a=blobdiff_plain;f=src%2Fremoted%2Fsyslogtcp.c;h=cce947ff065e54aef2cdfb557bed81b73a2c377c;hb=6ef2f786c6c8ead94841b5f93baf9f43421f08c8;hp=c0efcd5f1828c70c60bc2cb1ad1e9b852abd5592;hpb=914feba5d54f979cd5d7e69c349c3d01f630042a;p=ossec-hids.git diff --git a/src/remoted/syslogtcp.c b/src/remoted/syslogtcp.c index c0efcd5..cce947f 100755 --- a/src/remoted/syslogtcp.c +++ b/src/remoted/syslogtcp.c @@ -1,11 +1,12 @@ -/* @(#) $Id: syslogtcp.c,v 1.8 2009/06/24 18:53:07 dcid Exp $ */ +/* @(#) $Id: ./src/remoted/syslogtcp.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 - * License (version 3) as published by the FSF - Free Software + * License (version 2) as published by the FSF - Free Software * Foundation */ @@ -18,7 +19,7 @@ -/* OS_IPNotAllowed, v0.1, 2005/02/11 +/* OS_IPNotAllowed, v0.1, 2005/02/11 * Checks if an IP is not allowed. */ static int OS_IPNotAllowed(char *srcip) @@ -50,14 +51,14 @@ static void HandleClient(int client_socket, char *srcip) { int sb_size = OS_MAXSTR; int r_sz = 0; - + char buffer[OS_MAXSTR +2]; char storage_buffer[OS_MAXSTR +2]; char tmp_buffer[OS_MAXSTR +2]; char *buffer_pt = NULL; - + /* Initializing some variables */ memset(buffer, '\0', OS_MAXSTR +2); memset(storage_buffer, '\0', OS_MAXSTR +2); @@ -85,12 +86,12 @@ static void HandleClient(int client_socket, char *srcip) storage_buffer[0] = '\0'; continue; } - + strncat(storage_buffer, buffer, sb_size); sb_size -= r_sz; - continue; + continue; } - + /* Seeing if we received more then just one message */ if(*(buffer_pt +1) != '\0') { @@ -111,14 +112,14 @@ static void HandleClient(int client_socket, char *srcip) } strncat(storage_buffer, buffer, sb_size); - + /* Removing carriage returns too */ buffer_pt = strchr(storage_buffer, '\r'); if(buffer_pt) *buffer_pt = '\0'; - + /* Removing syslog header */ if(storage_buffer[0] == '<') { @@ -172,13 +173,13 @@ void HandleSyslogTCP() int client_socket = 0; int st_errors = 0; int childcount = 0; - + char srcip[IPSIZE +1]; /* Initializing some variables */ memset(srcip, '\0', IPSIZE + 1); - + /* Connecting to the message queue * Exit if it fails. */ @@ -186,7 +187,7 @@ void HandleSyslogTCP() { ErrorExit(QUEUE_FATAL,ARGV0, DEFAULTQUEUE); } - + /* Infinit loop in here */ while(1) @@ -222,7 +223,7 @@ void HandleSyslogTCP() } - /* Forking to deal with new client */ + /* Forking to deal with new client */ if(fork() == 0) { HandleClient(client_socket, srcip);