novi upstream verzije 2.8.3
[ossec-hids.git] / src / analysisd / dodiff.c
index c17de31..cc4b47d 100755 (executable)
@@ -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);
         }
@@ -89,7 +90,6 @@ int doDiff(RuleInfo *currently_rule, Eventinfo *lf)
     int date_of_change;
     char *htpt = NULL;
     char flastfile[OS_SIZE_2048 +1];
-    char fdifffile[OS_SIZE_2048 +1];
     char flastcontent[OS_SIZE_8192 +1];
 
 
@@ -99,6 +99,7 @@ int doDiff(RuleInfo *currently_rule, Eventinfo *lf)
     currently_rule->last_events[0] = NULL;
 
 
+
     if(lf->hostname[0] == '(')
     {
         htpt = strchr(lf->hostname, ')');
@@ -106,8 +107,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 +118,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 +134,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);
@@ -173,30 +173,6 @@ int doDiff(RuleInfo *currently_rule, Eventinfo *lf)
     }
 
 
-    /* File was modified. */
-    if(lf->hostname[0] == '(')
-    {
-        htpt = strchr(lf->hostname, ')');
-        if(htpt)
-        {
-            *htpt = '\0';
-        }
-        snprintf(fdifffile, OS_SIZE_2048, "%s/%s/%d/state.%d", DIFF_DIR, lf->hostname+1, 
-                 currently_rule->sigid, date_of_change); 
-
-        if(htpt)
-        {
-            *htpt = ')';
-        }
-        htpt = NULL;
-    }
-    else
-    {
-        snprintf(fdifffile, OS_SIZE_2048, "%s/%s/%d/state.%d", DIFF_DIR, lf->hostname, 
-                 currently_rule->sigid, date_of_change);
-    }
-
-    rename(flastfile, fdifffile);
     if(!_add2last(lf->log, lf->size, flastfile))
     {
         merror("%s: ERROR: unable to create last file: %s", ARGV0, flastfile);