X-Git-Url: http://ftp.carnet.hr/carnet-debian/scm?a=blobdiff_plain;f=src%2Fos_execd%2Fwin_execd.c;h=1af0f1b1219a714bc84886b0888a4d2cb28f3fcd;hb=6ef2f786c6c8ead94841b5f93baf9f43421f08c8;hp=3a02ffe1a4013af81aa717f641cfea2077e7f462;hpb=914feba5d54f979cd5d7e69c349c3d01f630042a;p=ossec-hids.git diff --git a/src/os_execd/win_execd.c b/src/os_execd/win_execd.c index 3a02ffe..1af0f1b 100755 --- a/src/os_execd/win_execd.c +++ b/src/os_execd/win_execd.c @@ -1,11 +1,12 @@ -/* @(#) $Id: win_execd.c,v 1.4 2009/06/24 17:06:30 dcid Exp $ */ +/* @(#) $Id: ./src/os_execd/win_execd.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 */ @@ -23,9 +24,9 @@ #ifdef ARGV0 #undef ARGV0 #endif - + #define ARGV0 "ossec-execd" - + @@ -41,7 +42,7 @@ typedef struct _timeout_data /* Timeout list */ OSList *timeout_list; OSListNode *timeout_node; - + @@ -66,15 +67,15 @@ int WinExecd_Start() /* Exit if test_config */ if(test_config) return(0); - - + + /* Active response disabled */ if(c == 1) { verbose(EXEC_DISABLED, ARGV0); return(0); } - + /* Creating list for timeout */ timeout_list = OSList_Create(); @@ -82,12 +83,12 @@ int WinExecd_Start() { ErrorExit(LIST_ERROR, ARGV0); } - - + + /* Start up message */ verbose(STARTUP_MSG, ARGV0, getpid()); - + return(1); } @@ -105,7 +106,7 @@ void WinTimeoutRun(int curr_time) 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]); @@ -146,7 +147,7 @@ void WinExecdRun(char *exec_msg) char *cmd_user; char *cmd_ip; char buffer[OS_MAXSTR + 1]; - + timeout_data *timeout_entry; @@ -194,7 +195,7 @@ void WinExecdRun(char *exec_msg) } *tmp_msg = '\0'; tmp_msg++; - + /* 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 */ - 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; - + /* Getting size for the strncmp */ @@ -233,12 +234,12 @@ void WinExecdRun(char *exec_msg) { if(buffer[i] == ' ') j++; - + i++; if(j == 4) break; } - + /* 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) { - 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 */ @@ -292,7 +293,7 @@ void WinExecdRun(char *exec_msg) { merror(LIST_ADD_ERROR, ARGV0); FreeTimeoutEntry(timeout_entry); - } + } } /* If no timeout, we still need to free it in here */