X-Git-Url: http://ftp.carnet.hr/carnet-debian/scm?p=ossec-hids.git;a=blobdiff_plain;f=src%2Fos_execd%2Fexec.c;h=7b0a673c116ad19d4095a385083c9da6faac361e;hp=b90bb401892fce1e68b50161d3f7654e947d91a7;hb=6ef2f786c6c8ead94841b5f93baf9f43421f08c8;hpb=301048b51990573e58a30dc4a5bb4ec285cad554 diff --git a/src/os_execd/exec.c b/src/os_execd/exec.c index b90bb40..7b0a673 100755 --- a/src/os_execd/exec.c +++ b/src/os_execd/exec.c @@ -1,11 +1,12 @@ -/* @(#) $Id$ */ +/* @(#) $Id: ./src/os_execd/exec.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 2) as published by the FSF - Free Software + * License (version 2) as published by the FSF - Free Software * Foundation */ @@ -21,9 +22,9 @@ int exec_size = 0; int f_time_reading = 1; -/** int ReadExecConfig() v0.1: +/** int ReadExecConfig() v0.1: * Reads the shared exec config. - * Returns 1 on success or 0 on failure. + * Returns 1 on success or 0 on failure. * Format of the file is 'name - command - timeout' */ int ReadExecConfig() @@ -41,8 +42,8 @@ int ReadExecConfig() exec_timeout[i] = 0; } exec_size = 0; - - + + /* Opening file */ fp = fopen(DEFAULTARPATH, "r"); if(!fp) @@ -70,7 +71,7 @@ int ReadExecConfig() *tmp_str = '\0'; tmp_str++; - + /* Searching for ' ' and - */ if(*tmp_str == '-') { @@ -83,12 +84,12 @@ int ReadExecConfig() } - + /* Setting the name */ strncpy(exec_names[exec_size], str_pt, OS_FLSIZE); exec_names[exec_size][OS_FLSIZE] = '\0'; - + str_pt = tmp_str; tmp_str = strchr(tmp_str, ' '); @@ -99,11 +100,11 @@ int ReadExecConfig() } *tmp_str = '\0'; - + /* Writting the full command path */ - snprintf(exec_cmd[exec_size], OS_FLSIZE, - "%s/%s", - AR_BINDIRPATH, + snprintf(exec_cmd[exec_size], OS_FLSIZE, + "%s/%s", + AR_BINDIRPATH, str_pt); process_file = fopen(exec_cmd[exec_size], "r"); if(!process_file) @@ -115,14 +116,14 @@ int ReadExecConfig() ARGV0, exec_cmd[exec_size]); } - exec_cmd[exec_size][0] = '\0'; + exec_cmd[exec_size][0] = '\0'; } else { fclose(process_file); } - + /* Searching for ' ' and - */ tmp_str++; if(*tmp_str == '-') @@ -134,14 +135,14 @@ int ReadExecConfig() merror(EXEC_INV_CONF, ARGV0, DEFAULTARPATH); continue; } - - - str_pt = tmp_str; + + + str_pt = tmp_str; tmp_str = strchr(tmp_str, '\n'); if(tmp_str) *tmp_str = '\0'; - + /* Getting the exec timeout */ exec_timeout[exec_size] = atoi(str_pt); @@ -165,7 +166,7 @@ int ReadExecConfig() } } } - + if(dup_entry) { exec_cmd[exec_size][0] = '\0';