projects
/
ossec-hids.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Imported Upstream version 2.7
[ossec-hids.git]
/
src
/
os_execd
/
win_execd.c
diff --git
a/src/os_execd/win_execd.c
b/src/os_execd/win_execd.c
index
c3203af
..
1af0f1b
100755
(executable)
--- a/
src/os_execd/win_execd.c
+++ b/
src/os_execd/win_execd.c
@@
-1,4
+1,5
@@
-/* @(#) $Id$ */
+/* @(#) $Id: ./src/os_execd/win_execd.c, 2011/09/08 dcid Exp $
+ */
/* Copyright (C) 2009 Trend Micro Inc.
* All right reserved.
/* Copyright (C) 2009 Trend Micro Inc.
* All right reserved.
@@
-23,9
+24,9
@@
#ifdef ARGV0
#undef ARGV0
#endif
#ifdef ARGV0
#undef ARGV0
#endif
-
+
#define ARGV0 "ossec-execd"
#define ARGV0 "ossec-execd"
-
+
@@
-41,7
+42,7
@@
typedef struct _timeout_data
/* Timeout list */
OSList *timeout_list;
OSListNode *timeout_node;
/* Timeout list */
OSList *timeout_list;
OSListNode *timeout_node;
-
+
@@
-66,15
+67,15
@@
int WinExecd_Start()
/* Exit if test_config */
if(test_config)
return(0);
/* Exit if test_config */
if(test_config)
return(0);
-
-
+
+
/* Active response disabled */
if(c == 1)
{
verbose(EXEC_DISABLED, ARGV0);
return(0);
}
/* Active response disabled */
if(c == 1)
{
verbose(EXEC_DISABLED, ARGV0);
return(0);
}
-
+
/* Creating list for timeout */
timeout_list = OSList_Create();
/* Creating list for timeout */
timeout_list = OSList_Create();
@@
-82,12
+83,12
@@
int WinExecd_Start()
{
ErrorExit(LIST_ERROR, ARGV0);
}
{
ErrorExit(LIST_ERROR, ARGV0);
}
-
-
+
+
/* Start up message */
verbose(STARTUP_MSG, ARGV0, getpid());
/* Start up message */
verbose(STARTUP_MSG, ARGV0, getpid());
-
+
return(1);
}
return(1);
}
@@
-105,7
+106,7
@@
void WinTimeoutRun(int curr_time)
list_entry = (timeout_data *)timeout_node->data;
/* Timeouted */
list_entry = (timeout_data *)timeout_node->data;
/* Timeouted */
- if((curr_time - list_entry->time_of_addition) >
+ if((curr_time - list_entry->time_of_addition) >
list_entry->time_to_block)
{
ExecCmd_Win32(list_entry->command[0]);
list_entry->time_to_block)
{
ExecCmd_Win32(list_entry->command[0]);
@@
-146,7
+147,7
@@
void WinExecdRun(char *exec_msg)
char *cmd_user;
char *cmd_ip;
char buffer[OS_MAXSTR + 1];
char *cmd_user;
char *cmd_ip;
char buffer[OS_MAXSTR + 1];
-
+
timeout_data *timeout_entry;
timeout_data *timeout_entry;
@@
-194,7
+195,7
@@
void WinExecdRun(char *exec_msg)
}
*tmp_msg = '\0';
tmp_msg++;
}
*tmp_msg = '\0';
tmp_msg++;
-
+
/* Getting the command to execute (valid name) */
command = GetCommandbyName(name, &timeout_value);
/* Getting the command to execute (valid name) */
command = GetCommandbyName(name, &timeout_value);
@@
-220,11
+221,11
@@
void WinExecdRun(char *exec_msg)
/* Adding initial variables to the timeout cmd */
/* Adding initial variables to the timeout cmd */
- snprintf(buffer, OS_MAXSTR, "\"%s\" %s \"%s\" \"%s\" \"%s\"",
- command, DELETE_ENTRY, cmd_user, cmd_ip, tmp_msg);
+ snprintf(buffer, OS_MAXSTR, "\"%s\" %s \"%s\" \"%s\" \"%s\"",
+ command, DELETE_ENTRY, cmd_user, cmd_ip, tmp_msg);
os_strdup(buffer, timeout_args[0]);
timeout_args[1] = NULL;
os_strdup(buffer, timeout_args[0]);
timeout_args[1] = NULL;
-
+
/* Getting size for the strncmp */
/* Getting size for the strncmp */
@@
-233,12
+234,12
@@
void WinExecdRun(char *exec_msg)
{
if(buffer[i] == ' ')
j++;
{
if(buffer[i] == ' ')
j++;
-
+
i++;
if(j == 4)
break;
}
i++;
if(j == 4)
break;
}
-
+
/* Check this command was already executed. */
timeout_node = OSList_GetFirstNode(timeout_list);
/* Check this command was already executed. */
timeout_node = OSList_GetFirstNode(timeout_list);
@@
-271,7
+272,7
@@
void WinExecdRun(char *exec_msg)
/* If it wasn't added before, do it now */
if(!added_before)
{
/* If it wasn't added before, do it now */
if(!added_before)
{
- snprintf(buffer, OS_MAXSTR, "\"%s\" %s \"%s\" \"%s\" \"%s\"", command,
+ snprintf(buffer, OS_MAXSTR, "\"%s\" %s \"%s\" \"%s\" \"%s\"", command,
ADD_ENTRY, cmd_user, cmd_ip, tmp_msg);
/* executing command */
ADD_ENTRY, cmd_user, cmd_ip, tmp_msg);
/* executing command */
@@
-292,7
+293,7
@@
void WinExecdRun(char *exec_msg)
{
merror(LIST_ADD_ERROR, ARGV0);
FreeTimeoutEntry(timeout_entry);
{
merror(LIST_ADD_ERROR, ARGV0);
FreeTimeoutEntry(timeout_entry);
- }
+ }
}
/* If no timeout, we still need to free it in here */
}
/* If no timeout, we still need to free it in here */