[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[ossec-dev] ossec-hids: monitor_agents.c (NEW) main.c (HEAD) monitord.c (HEAD) monitord.h (HEAD) [dcid]
- To: dancid@xxxxxxxxxxxxxxx
- Subject: [ossec-dev] ossec-hids: monitor_agents.c (NEW) main.c (HEAD) monitord.c (HEAD) monitord.h (HEAD) [dcid]
- From: OSSEC CVS <cvs-commit@xxxxxxxxx>
- Date: Tue, 29 Aug 2006 16:35:45 -0300 (ADT)
- Content-transfer-encoding: 8bit
Module name: ossec-hids
Changes by: dcid 06/08/29 16:35:42
Modified files:
main.c monitord.c monitord.h
Added files:
monitor_agents.c
Log message:
Description: More fixes for the client/server control. Added global ossec lock and some new rules..
Reviewed by: dcid
Bug:
--- NEW FILE: monitor_agents.c ---
/* @(#) $Id: monitor_agents.c,v 1.1 2006/08/29 19:35:42 dcid Exp $ */
/* Copyright (C) 2006 Daniel B. Cid <dcid@xxxxxxxxx>
* 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 2) as published by the FSF - Free Software
* Foundation
*/
#include "shared.h"
#include "monitord.h"
#include "read-agents.h"
void monitor_agents()
{
char **cr_agents;
char **av_agents;
av_agents = get_agents(GA_ACTIVE);
/* No agent saved */
if(!mond.agents)
{
mond.agents = av_agents;
return;
}
/* Checking if any of the previous available agents
* are disconnected.
*/
cr_agents = mond.agents;
while(*cr_agents)
{
int available = 0;
char **tmp_av;
tmp_av = av_agents;
while(tmp_av && *tmp_av)
{
if(strcmp(*cr_agents, *tmp_av) == 0)
{
available = 1;
break;
}
tmp_av++;
}
/* Agent disconnected */
if(available == 0)
{
char str[OS_MAXSTR +1];
/* Sending disconnected message */
snprintf(str, OS_MAXSTR -1, OS_AG_DISCON, *cr_agents);
if(SendMSG(mond.a_queue, str, ARGV0,
LOCALFILE_MQ) < 0)
{
merror(QUEUE_SEND, ARGV0);
}
}
cr_agents++;
}
/* Removing old agent list and adding currently one */
free_agents(mond.agents);
mond.agents = av_agents;
return;
}
/* EOF */
Index: main.c
===================================================================
RCS file: /usr/cvsroot/ossec-hids/src/monitord/main.c,v
diff -u -r1.1 -r1.2
--- main.c 28 Aug 2006 18:45:26 -0000 1.1
+++ main.c 29 Aug 2006 19:35:42 -0000 1.2
@@ -88,6 +88,8 @@
mond.monitor_agents = getDefine_Int("monitord","monitor_agents",0,1);
+ mond.agents = NULL;
+
/* Exit here if test config is set */
if(test_config)
Index: monitord.c
===================================================================
RCS file: /usr/cvsroot/ossec-hids/src/monitord/monitord.c,v
diff -u -r1.1 -r1.2
--- monitord.c 28 Aug 2006 18:45:26 -0000 1.1
+++ monitord.c 29 Aug 2006 19:35:42 -0000 1.2
@@ -63,6 +63,7 @@
p = localtime(&tm);
/* Checking unavailable agents */
+ monitor_agents();
/* Day changed, deal with log files */
if(today != p->tm_mday)
Index: monitord.h
===================================================================
RCS file: /usr/cvsroot/ossec-hids/src/monitord/monitord.h,v
diff -u -r1.1 -r1.2
--- monitord.h 28 Aug 2006 18:45:26 -0000 1.1
+++ monitord.h 29 Aug 2006 19:35:42 -0000 1.2
@@ -24,6 +24,8 @@
short int sign;
short int monitor_agents;
int a_queue;
+
+ char **agents;
}monitor_config;
@@ -34,6 +36,9 @@
/*manage_files */
void manage_files(int cday, int cmon, int cyear);
+
+/* monitor_agents */
+void monitor_agents();
/* Compress log */
void OS_CompressLog(char *logfile);
OSSEC home |
Main Index |
Thread Index
OSSEC project: www.ossec.net.
Mailling list information: http://www.ossec.net/en/mailing_lists.html.