Skip to content
This repository has been archived by the owner on Dec 29, 2020. It is now read-only.

Commit

Permalink
Solution for Issue #7 loc field missing
Browse files Browse the repository at this point in the history
  • Loading branch information
Suman Aryal authored and Andrea De Pasquale committed Jun 3, 2016
1 parent 57f9b2d commit 56702c6
Showing 1 changed file with 19 additions and 7 deletions.
26 changes: 19 additions & 7 deletions fw1-loggrabber.c
Original file line number Diff line number Diff line change
Expand Up @@ -951,6 +951,7 @@ read_fw1_logfile_record (OpsecSession * pSession, lea_record * pRec,
unsigned int messagecap = 0;
time_t logtime;
struct tm *datetime;
char szNum[20];

if (cfgvalues.debug_mode >= 2)
{
Expand All @@ -961,6 +962,7 @@ read_fw1_logfile_record (OpsecSession * pSession, lea_record * pRec,
* process all fields of logentry
*/
number_fields = pRec->n_fields;
int j = 0;
for (i = 0; i < number_fields; i++)
{
ignore = FALSE;
Expand Down Expand Up @@ -1048,17 +1050,27 @@ read_fw1_logfile_record (OpsecSession * pSession, lea_record * pRec,
}
}

szAttrib = lea_attr_name (pSession, pRec->fields[i].lea_attr_id);
if (j == 0)
{
/*
* get record position
*/
sprintf (szNum, "%d", lea_get_record_pos (pSession) - 1);
*field_headers[j] = string_duplicate(string_duplicate ("loc"));
*field_values[j] = string_duplicate (szNum);
}
j++; //increase the counter for field_headers and field_values

*field_headers[i] = string_duplicate (szAttrib);
szAttrib = lea_attr_name (pSession, pRec->fields[i].lea_attr_id);
*field_headers[j] = string_duplicate (szAttrib);

if (tmpdata[0])
{
*field_values[i] = string_duplicate (tmpdata);
*field_values[j] = string_duplicate (tmpdata);
}
else
{
*field_values[i] =
*field_values[j] =
string_duplicate (lea_resolve_field
(pSession, pRec->fields[i]));
}
Expand All @@ -1067,7 +1079,8 @@ read_fw1_logfile_record (OpsecSession * pSession, lea_record * pRec,
/*
* print logentry to stdout
*/
for (i = 0; i < number_fields; i++)
number_fields = j; //get size of field_headers
for (i = 0; i <= number_fields; i++)
{
if (*field_values[i])
{
Expand Down Expand Up @@ -5534,5 +5547,4 @@ ThreadFuncReturnType leaRecordProcessor( void *data ){
}//end while

return 0;
}

}

0 comments on commit 56702c6

Please sign in to comment.