X-Git-Url: http://ftp.carnet.hr/carnet-debian/scm?a=blobdiff_plain;f=src%2Fremoted%2Far-forward.c;h=df76769705494196025c77488e86f272af835c58;hb=6ef2f786c6c8ead94841b5f93baf9f43421f08c8;hp=c2035f3066d0efb08f43e9ef9fc39b7915e47242;hpb=914feba5d54f979cd5d7e69c349c3d01f630042a;p=ossec-hids.git diff --git a/src/remoted/ar-forward.c b/src/remoted/ar-forward.c index c2035f3..df76769 100755 --- a/src/remoted/ar-forward.c +++ b/src/remoted/ar-forward.c @@ -1,11 +1,12 @@ -/* @(#) $Id: ar-forward.c,v 1.27 2009/06/24 18:53:07 dcid Exp $ */ +/* @(#) $Id: ./src/remoted/ar-forward.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 */ @@ -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 */