"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/util.c" between
snort-2.9.16.1.tar.gz and snort-2.9.17.tar.gz

About: Snort is a network intrusion prevention and detection system (IDS/IPS) combining the benefits of signature, protocol and anomaly-based inspection.

util.c  (snort-2.9.16.1):util.c  (snort-2.9.17)
skipping to change at line 508 skipping to change at line 508
} }
ErrorMessage("%s",buf); ErrorMessage("%s",buf);
throttleInfo->lastUpdate = current_time; throttleInfo->lastUpdate = current_time;
throttleInfo->count = 0; throttleInfo->count = 0;
} }
} }
/* /*
* Function: LogThrottledByTimeCount(ThrottleInfo *,const char *, ...)
*
* Purpose: Print a message based on time and count of messages.
*
* Arguments: throttleInfo => point to the saved throttle state information
* format => the formatted message string to print out
* ... => format commands/fillers
*
* Returns: void function
*/
void LogThrottledByTimeCount(ThrottleInfo *throttleInfo, const char *format,...)
{
char buf[STD_BUF+1];
va_list ap;
time_t current_time = packet_time();
if ((!snort_conf) || (!throttleInfo))
return;
if (!ScCheckInternalLogLevel(INTERNAL_LOG_LEVEL__ERROR))
return;
throttleInfo->count++;
DEBUG_WRAP(DebugMessage(DEBUG_INIT,"current_time: %d, throttle (%p): count "
STDu64", last update: %d\n",
(int)current_time, throttleInfo, throttleInfo->count, (int)throt
tleInfo->lastUpdate );)
if ((throttleInfo->lastUpdate == 0)
|| ((current_time - (time_t)throttleInfo->duration_to_log > throttleI
nfo->lastUpdate)
&& ((throttleInfo->count == 1)
|| throttleInfo->count > throttleInfo->count_to_log)))
{
int index;
va_start(ap, format);
index = vsnprintf(buf, STD_BUF, format, ap);
va_end(ap);
if (index)
{
snprintf(&buf[index - 1], STD_BUF-index,
" (suppressed "STDu64" times in the last %d seconds).\n",
throttleInfo->count, throttleInfo->lastUpdate
? ((int)(current_time - throttleInfo->lastUpdate))
: ((int)throttleInfo->lastUpdate));
}
LogMessage("%s",buf);
throttleInfo->lastUpdate = current_time;
throttleInfo->count = 0;
}
}
/*
* Function: LogMessage(const char *, ...) * Function: LogMessage(const char *, ...)
* *
* Purpose: Print a message to stderr or with logfacility. * Purpose: Print a message to stderr or with logfacility.
* *
* Arguments: format => the formatted error string to print out * Arguments: format => the formatted error string to print out
* ... => format commands/fillers * ... => format commands/fillers
* *
* Returns: void function * Returns: void function
*/ */
void LogMessage(const char *format,...) void LogMessage(const char *format,...)
skipping to change at line 707 skipping to change at line 759
{ {
fprintf(stderr, "ERROR: %s", buf); fprintf(stderr, "ERROR: %s", buf);
fprintf(stderr,"Fatal Error, Quitting..\n"); fprintf(stderr,"Fatal Error, Quitting..\n");
#if defined(WIN32) && defined(ENABLE_WIN32_SERVICE) #if defined(WIN32) && defined(ENABLE_WIN32_SERVICE)
CreateApplicationEventLogEntry(buf); CreateApplicationEventLogEntry(buf);
#endif #endif
} }
if ( InMainThread() || SnortIsInitializing() ) if ( InMainThread() || SnortIsInitializing() )
{ {
if (!SnortIsInitializing())
{
/*
* Shutdown the thread only when the snort is not
* initializing. Because FatalError api can be
* called during initialization as well.
*/
SnortShutdownThreads(1);
}
DAQ_Abort(); DAQ_Abort();
exit(1); exit(1);
} }
else else
{ {
DAQ_BreakLoop(1); DAQ_BreakLoop(1);
#ifndef WIN32 #ifndef WIN32
pthread_exit(NULL); pthread_exit(NULL);
#endif #endif
} }
 End of changes. 2 change blocks. 
0 lines changed or deleted 64 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)