-/* @(#) $Id: fts.c,v 1.34 2009/06/24 17:06:22 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All rights 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.
*
* License details at the LICENSE file included with OSSEC or
int fts_minsize_for_str = 0;
OSList *fts_list = NULL;
-OSStore *fts_store = NULL;
+OSHash *fts_store = NULL;
FILE *fp_list = NULL;
FILE *fp_ignore = NULL;
}
/* Creating store data */
- fts_store = OSStore_Create();
+ fts_store = OSHash_Create();
if(!fts_store)
{
merror(LIST_ERROR, ARGV0);
return(0);
}
+ if(!OSHash_setSize(fts_store, 2048))
+ {
+ merror(LIST_ERROR, ARGV0);
+ return(0);
+ }
+
/* Getting default list size */
fts_list_size = getDefine_Int("analysisd",
"fts_list_size",
os_strdup(_line, tmp_s);
- if(!OSStore_Put(fts_store, tmp_s, NULL))
+ if(OSHash_Add(fts_store, tmp_s, tmp_s) <= 0)
{
+ free(tmp_s);
merror(LIST_ADD_ERROR, ARGV0);
}
}
/** Checking if FTS is already present **/
- if(lf->decoder_info->type == WINDOWS)
- {
- /* Windows is case insensitive */
- if(OSStore_NCaseCheck(fts_store, _line))
- {
- return(0);
- }
- }
- else if(OSStore_NCheck(fts_store, _line))
+ if(OSHash_Get(fts_store, _line))
{
return(0);
- }
+ }
/* Checking if from the last FTS events, we had
os_strdup(_line, line_for_list);
}
- if(!OSStore_Put(fts_store, line_for_list, NULL))
+ if(OSHash_Add(fts_store, line_for_list, line_for_list) <= 1)
{
- merror(LIST_ADD_ERROR, ARGV0);
+ return(0);
}