X-Git-Url: http://ftp.carnet.hr/carnet-debian/scm?p=ossec-hids.git;a=blobdiff_plain;f=src%2Fanalysisd%2Fdodiff.c;h=2fba506e1bb8179257af19c9f3be687d4f776da2;hp=c17de31e6a98f643aa3c7844ddf18aa301c32fa6;hb=6ef2f786c6c8ead94841b5f93baf9f43421f08c8;hpb=301048b51990573e58a30dc4a5bb4ec285cad554 diff --git a/src/analysisd/dodiff.c b/src/analysisd/dodiff.c index c17de31..2fba506 100755 --- a/src/analysisd/dodiff.c +++ b/src/analysisd/dodiff.c @@ -1,4 +1,5 @@ -/* @(#) $Id$ */ +/* @(#) $Id: ./src/analysisd/dodiff.c, 2012/07/23 dcid Exp $ + */ /* Copyright (C) 2010 Trend Micro Inc. * All rights reserved. @@ -8,7 +9,7 @@ * License (version 2) as published by the FSF - Free Software * Foundation. * - * License details at the LICENSE file included with OSSEC or + * License details at the LICENSE file included with OSSEC or * online at: http://www.ossec.net/en/licensing.html */ @@ -34,7 +35,7 @@ static int _add2last(char *str, int strsize, char *file) dirrule = strrchr(file, '/'); if(!dirrule) { - merror("%s: ERROR: Invalid file name to diff: %s", + merror("%s: ERROR: Invalid file name to diff: %s", ARGV0, file); return(0); } @@ -99,6 +100,7 @@ int doDiff(RuleInfo *currently_rule, Eventinfo *lf) currently_rule->last_events[0] = NULL; + if(lf->hostname[0] == '(') { htpt = strchr(lf->hostname, ')'); @@ -106,8 +108,8 @@ int doDiff(RuleInfo *currently_rule, Eventinfo *lf) { *htpt = '\0'; } - snprintf(flastfile, OS_SIZE_2048, "%s/%s/%d/%s", DIFF_DIR, lf->hostname+1, - currently_rule->sigid, DIFF_LAST_FILE); + snprintf(flastfile, OS_SIZE_2048, "%s/%s/%d/%s", DIFF_DIR, lf->hostname+1, + currently_rule->sigid, DIFF_LAST_FILE); if(htpt) { @@ -117,7 +119,7 @@ int doDiff(RuleInfo *currently_rule, Eventinfo *lf) } else { - snprintf(flastfile, OS_SIZE_2048, "%s/%s/%d/%s", DIFF_DIR, lf->hostname, + snprintf(flastfile, OS_SIZE_2048, "%s/%s/%d/%s", DIFF_DIR, lf->hostname, currently_rule->sigid, DIFF_LAST_FILE); } @@ -133,7 +135,6 @@ int doDiff(RuleInfo *currently_rule, Eventinfo *lf) date_of_change = File_DateofChange(flastfile); if(date_of_change <= 0) { - merror("last file: %s",flastfile); if(!_add2last(lf->log, lf->size, flastfile)) { merror("%s: ERROR: unable to create last file: %s", ARGV0, flastfile); @@ -181,8 +182,8 @@ int doDiff(RuleInfo *currently_rule, Eventinfo *lf) { *htpt = '\0'; } - snprintf(fdifffile, OS_SIZE_2048, "%s/%s/%d/state.%d", DIFF_DIR, lf->hostname+1, - currently_rule->sigid, date_of_change); + snprintf(fdifffile, OS_SIZE_2048, "%s/%s/%d/state.%d", DIFF_DIR, lf->hostname+1, + currently_rule->sigid, date_of_change); if(htpt) { @@ -192,7 +193,7 @@ int doDiff(RuleInfo *currently_rule, Eventinfo *lf) } else { - snprintf(fdifffile, OS_SIZE_2048, "%s/%s/%d/state.%d", DIFF_DIR, lf->hostname, + snprintf(fdifffile, OS_SIZE_2048, "%s/%s/%d/state.%d", DIFF_DIR, lf->hostname, currently_rule->sigid, date_of_change); }