file: clarify file store id name

pull/2705/head
Victor Julien 9 years ago
parent f18c976a8e
commit 944ab48b20

@ -262,7 +262,7 @@ static int DetectFilestoreMatch (ThreadVars *t, DetectEngineThreadCtx *det_ctx,
/* file can be NULL when a rule with filestore scope > file
* matches. */
if (file != NULL) {
file_id = file->file_id;
file_id = file->file_store_id;
}
det_ctx->filestore[det_ctx->filestore_cnt].file_id = file_id;

@ -206,8 +206,8 @@ static void LogFileWriteJsonRecord(LogFileLogThread *aft, const Packet *p, const
fprintf(fp, "{ ");
if (ff->file_id > 0)
fprintf(fp, "\"id\": %u, ", ff->file_id);
if (ff->file_store_id > 0)
fprintf(fp, "\"id\": %u, ", ff->file_store_id);
fprintf(fp, "\"timestamp\": \"");
PrintRawJsonFp(fp, (uint8_t *)timebuf, strlen(timebuf));

@ -243,7 +243,7 @@ static void LogFilestoreLogCloseMetaFile(const File *ff)
{
char filename[PATH_MAX] = "";
snprintf(filename, sizeof(filename), "%s/file.%u",
g_logfile_base_dir, ff->file_id);
g_logfile_base_dir, ff->file_store_id);
char metafilename[PATH_MAX] = "";
snprintf(metafilename, sizeof(metafilename), "%s.meta", filename);
FILE *fp = fopen(metafilename, "a");
@ -325,7 +325,7 @@ static int LogFilestoreLogger(ThreadVars *tv, void *thread_data, const Packet *p
SCLogDebug("ff %p, data %p, data_len %u", ff, data, data_len);
snprintf(filename, sizeof(filename), "%s/file.%u",
g_logfile_base_dir, ff->file_id);
g_logfile_base_dir, ff->file_store_id);
if (flags & OUTPUT_FILEDATA_FLAG_OPEN) {
aft->file_cnt++;

@ -193,9 +193,9 @@ static TmEcode OutputFiledataLog(ThreadVars *tv, Packet *p, void *thread_data)
/* store */
/* if file_id == 0, this is the first store of this file */
if (ff->file_id == 0) {
if (ff->file_store_id == 0) {
/* new file */
ff->file_id = SC_ATOMIC_ADD(file_id, 1);
ff->file_store_id = SC_ATOMIC_ADD(file_id, 1);
flags |= OUTPUT_FILEDATA_FLAG_OPEN;
} else {
/* existing file */

@ -170,7 +170,7 @@ static void FileWriteJsonRecord(JsonFileLogThread *aft, const Packet *p, const F
json_object_set_new(fjs, "stored",
(ff->flags & FILE_STORED) ? json_true() : json_false());
if (ff->flags & FILE_STORED) {
json_object_set_new(fjs, "file_id", json_integer(ff->file_id));
json_object_set_new(fjs, "file_id", json_integer(ff->file_store_id));
}
json_object_set_new(fjs, "size", json_integer(FileTrackedSize(ff)));
json_object_set_new(fjs, "tx_id", json_integer(ff->txid));

@ -1103,7 +1103,7 @@ void FileStoreFileById(FileContainer *fc, uint32_t file_id)
if (fc != NULL) {
for (ptr = fc->head; ptr != NULL; ptr = ptr->next) {
if (ptr->file_id == file_id) {
if (ptr->file_store_id == file_id) {
FileStore(ptr);
}
}

@ -65,7 +65,7 @@ typedef struct File_ {
int16_t state;
StreamingBuffer *sb;
uint64_t txid; /**< tx this file is part of */
uint32_t file_id;
uint32_t file_store_id; /**< id used in store file name file.<id> */
uint8_t *name;
#ifdef HAVE_MAGIC
char *magic;

@ -719,7 +719,7 @@ static int LuaCallbackFileInfoPushToStackFromFile(lua_State *luastate, const Fil
char *sha256ptr = NULL;
#endif
lua_pushnumber(luastate, file->file_id);
lua_pushnumber(luastate, file->file_store_id);
lua_pushnumber(luastate, file->txid);
lua_pushlstring(luastate, (char *)file->name, file->name_len);
lua_pushnumber(luastate, FileTrackedSize(file));

Loading…
Cancel
Save