X-Git-Url: http://ftp.carnet.hr/carnet-debian/scm?p=ossec-hids.git;a=blobdiff_plain;f=src%2Fagentlessd%2Fagentlessd.c;fp=src%2Fagentlessd%2Fagentlessd.c;h=2db347f0a8805bee0f5d49c8ec7c1717cbc11b67;hp=6e6bd2e5a3fe683508813bbaba07446fc09ed695;hb=a62b46c229549212d536867b7e5e24d7576ebe8b;hpb=d623b82886b9b5fbba3fa27c3bfac51f3f8af108 diff --git a/src/agentlessd/agentlessd.c b/src/agentlessd/agentlessd.c index 6e6bd2e..2db347f 100755 --- a/src/agentlessd/agentlessd.c +++ b/src/agentlessd/agentlessd.c @@ -1,11 +1,11 @@ -/* @(#) $Id: agentlessd.c,v 1.13 2009/06/24 17:06:20 dcid Exp $ */ +/* @(#) $Id$ */ /* Copyright (C) 2009 Trend Micro Inc. * All rights 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 */ @@ -69,6 +69,30 @@ int send_intcheck_msg(char *script, char *host, char *msg) +/* Send generic log message. */ +int send_log_msg(char *script, char *host, char *msg) +{ + char sys_location[1024 +1]; + + sys_location[1024] = '\0'; + snprintf(sys_location, 1024, "(%s) %s->%s", script, host, SYSCHECK); + + if(SendMSG(lessdc.queue, msg, sys_location, LOCALFILE_MQ) < 0) + { + merror(QUEUE_SEND, ARGV0); + if((lessdc.queue = StartMQ(DEFAULTQPATH, WRITE)) < 0) + { + ErrorExit(QUEUE_FATAL, ARGV0, DEFAULTQPATH); + } + + /* If we reach here, we can try to send it again */ + SendMSG(lessdc.queue, msg, sys_location, LOCALFILE_MQ); + } + return(0); +} + + + /* Generate diffs alerts. */ int gen_diff_alert(char *host, char *script, int alert_diff_time) { @@ -392,6 +416,12 @@ int run_periodic_cmd(agentlessd_entries *entry, int test_it) send_intcheck_msg(entry->type, entry->server[i]+1, tmp_str); } + else if(strncmp(buf, "LOG: ", 4) == 0) + { + tmp_str = buf + 5; + send_log_msg(entry->type, entry->server[i]+1, + tmp_str); + } else if((entry->state & LESSD_STATE_DIFF) && (strncmp(buf, "STORE: ", 7) == 0)) {