X-Git-Url: http://ftp.carnet.hr/carnet-debian/scm?p=ossec-hids.git;a=blobdiff_plain;f=src%2Fremoted%2Far-forward.c;h=df76769705494196025c77488e86f272af835c58;hp=1e6bc1c9b1eb1e91948b685bb975cd9655e555b6;hb=6ef2f786c6c8ead94841b5f93baf9f43421f08c8;hpb=301048b51990573e58a30dc4a5bb4ec285cad554 diff --git a/src/remoted/ar-forward.c b/src/remoted/ar-forward.c index 1e6bc1c..df76769 100755 --- a/src/remoted/ar-forward.c +++ b/src/remoted/ar-forward.c @@ -1,4 +1,5 @@ -/* @(#) $Id$ */ +/* @(#) $Id: ./src/remoted/ar-forward.c, 2011/09/08 dcid Exp $ + */ /* Copyright (C) 2009 Trend Micro Inc. * All right reserved. @@ -28,9 +29,9 @@ void *AR_Forward(void *arg) int arq = 0; int agent_id = 0; int ar_location = 0; - + char msg_to_send[OS_SIZE_1024 +1]; - + char msg[OS_SIZE_1024 +1]; char *location = NULL; char *ar_location_str = NULL; @@ -53,8 +54,8 @@ void *AR_Forward(void *arg) { /* Always zeroing the location */ ar_location = 0; - - + + /* Getting the location */ location = msg; @@ -104,8 +105,8 @@ void *AR_Forward(void *arg) { ar_location|=SPECIFIC_AGENT; } - - + + /*** Extracting the active response location ***/ tmp_str = strchr(ar_location_str, ' '); if(!tmp_str) @@ -127,28 +128,28 @@ void *AR_Forward(void *arg) } *tmp_str = '\0'; tmp_str++; - - + + /*** Creating the new message ***/ if(ar_location & NO_AR_MSG) { - snprintf(msg_to_send, OS_SIZE_1024, "%s%s", + snprintf(msg_to_send, OS_SIZE_1024, "%s%s", CONTROL_HEADER, tmp_str); } else { - snprintf(msg_to_send, OS_SIZE_1024, "%s%s%s", + snprintf(msg_to_send, OS_SIZE_1024, "%s%s%s", CONTROL_HEADER, EXECD_HEADER, tmp_str); } - + /* Lock use of keys */ key_lock(); - - + + /* Sending to ALL agents */ if(ar_location & ALL_AGENTS) { @@ -168,7 +169,7 @@ void *AR_Forward(void *arg) merror(AR_NOAGENT_ERROR, ARGV0, location); continue; } - + send_msg(agent_id, msg_to_send); } @@ -178,7 +179,7 @@ void *AR_Forward(void *arg) ar_location++; agent_id = OS_IsAllowedID(&keys, ar_agent_id); - + if(agent_id < 0) { key_unlock(); @@ -195,6 +196,6 @@ void *AR_Forward(void *arg) } } - + /* EOF */