X-Git-Url: http://ftp.carnet.hr/carnet-debian/scm?p=ossec-hids.git;a=blobdiff_plain;f=src%2Flogcollector%2Fread_command.c;h=a6c413f39b41ab8a5f7e9a6d0607dc567b5a02b7;hp=9c1f7ca4e6d6d7fe310fbcfe82764ae1e3024e70;hb=301048b51990573e58a30dc4a5bb4ec285cad554;hpb=914feba5d54f979cd5d7e69c349c3d01f630042a diff --git a/src/logcollector/read_command.c b/src/logcollector/read_command.c index 9c1f7ca..a6c413f 100755 --- a/src/logcollector/read_command.c +++ b/src/logcollector/read_command.c @@ -1,11 +1,11 @@ -/* @(#) $Id: read_command.c,v 1.3 2009/11/05 19:55:34 dcid Exp $ */ +/* @(#) $Id$ */ /* 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 */ @@ -43,7 +43,10 @@ void *read_command(int pos, int *rc, int drop_it) } - snprintf(str, 256, "ossec: output: '%s': ", logff[pos].command); + snprintf(str, 256, "ossec: output: '%s': ", + (NULL != logff[pos].alias) + ? logff[pos].alias + : logff[pos].command); cmd_size = strlen(str); @@ -54,6 +57,19 @@ void *read_command(int pos, int *rc, int drop_it) { *p = '\0'; } + + /* Removing empty lines. */ + #ifdef WIN32 + if(str[0] == '\r' && str[1] == '\0') + { + continue; + } + #endif + if(str[0] == '\0') + { + continue; + } + debug2("%s: DEBUG: Reading command message: '%s'", ARGV0, str); @@ -61,7 +77,8 @@ void *read_command(int pos, int *rc, int drop_it) /* Sending message to queue */ if(drop_it == 0) { - if(SendMSG(logr_queue,str,logff[pos].command, + if(SendMSG(logr_queue,str, + (NULL != logff[pos].alias) ? logff[pos].alias : logff[pos].command, LOCALFILE_MQ) < 0) { merror(QUEUE_SEND, ARGV0);