-/* @(#) $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
*/
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;
{
/* Always zeroing the location */
ar_location = 0;
-
-
+
+
/* Getting the location */
location = msg;
{
ar_location|=SPECIFIC_AGENT;
}
-
-
+
+
/*** Extracting the active response location ***/
tmp_str = strchr(ar_location_str, ' ');
if(!tmp_str)
}
*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)
{
merror(AR_NOAGENT_ERROR, ARGV0, location);
continue;
}
-
+
send_msg(agent_id, msg_to_send);
}
ar_location++;
agent_id = OS_IsAllowedID(&keys, ar_agent_id);
-
+
if(agent_id < 0)
{
key_unlock();
}
}
-
+
/* EOF */