projects
/
ossec-hids.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
izmjene za lintian
[ossec-hids.git]
/
src
/
logcollector
/
read_mysql_log.c
diff --git
a/src/logcollector/read_mysql_log.c
b/src/logcollector/read_mysql_log.c
index
68dafc9
..
7d76d56
100755
(executable)
--- a/
src/logcollector/read_mysql_log.c
+++ b/
src/logcollector/read_mysql_log.c
@@
-1,4
+1,5
@@
-/* @(#) $Id$ */
+/* @(#) $Id: ./src/logcollector/read_mysql_log.c, 2011/09/08 dcid Exp $
+ */
/* Copyright (C) 2009 Trend Micro Inc.
* All rights reserved.
/* Copyright (C) 2009 Trend Micro Inc.
* All rights reserved.
@@
-40,13
+41,13
@@
void *read_mysql_log(int pos, int *rc, int drop_it)
/* Getting new entry */
while(fgets(str, OS_MAXSTR - OS_LOG_HEADER, logff[pos].fp) != NULL)
{
/* Getting new entry */
while(fgets(str, OS_MAXSTR - OS_LOG_HEADER, logff[pos].fp) != NULL)
{
-
+
/* Getting buffer size */
str_len = strlen(str);
/* Getting buffer size */
str_len = strlen(str);
-
+
/* Getting the last occurence of \n */
/* Getting the last occurence of \n */
- if ((p = strrchr(str, '\n')) != NULL)
+ if ((p = strrchr(str, '\n')) != NULL)
{
*p = '\0';
{
*p = '\0';
@@
-61,8
+62,8
@@
void *read_mysql_log(int pos, int *rc, int drop_it)
{
need_clear = 1;
}
{
need_clear = 1;
}
-
-
+
+
#ifdef WIN32
if ((p = strrchr(str, '\r')) != NULL)
{
#ifdef WIN32
if ((p = strrchr(str, '\r')) != NULL)
{
@@
-84,14
+85,14
@@
void *read_mysql_log(int pos, int *rc, int drop_it)
}
#endif
}
#endif
-
+
/* Mysql messages have the following format:
* 070823 21:01:30 xx
*/
if((str_len > 18) &&
/* Mysql messages have the following format:
* 070823 21:01:30 xx
*/
if((str_len > 18) &&
- (str[6] == ' ') &&
- (str[9] == ':') &&
- (str[12] == ':') &&
+ (str[6] == ' ') &&
+ (str[9] == ':') &&
+ (str[12] == ':') &&
isdigit((int)str[0]) &&
isdigit((int)str[1]) &&
isdigit((int)str[2]) &&
isdigit((int)str[0]) &&
isdigit((int)str[1]) &&
isdigit((int)str[2]) &&
@@
-105,21
+106,21
@@
void *read_mysql_log(int pos, int *rc, int drop_it)
strncpy(__mysql_last_time, str, 16);
__mysql_last_time[15] = '\0';
strncpy(__mysql_last_time, str, 16);
__mysql_last_time[15] = '\0';
-
+
/* Removing spaces and tabs */
p = str + 15;
while(*p == ' ' || *p == '\t')
{
p++;
}
/* Removing spaces and tabs */
p = str + 15;
while(*p == ' ' || *p == '\t')
{
p++;
}
-
-
+
+
/* Valid MySQL message */
/* Valid MySQL message */
- snprintf(buffer, OS_MAXSTR, "MySQL log: %s %s",
+ snprintf(buffer, OS_MAXSTR, "MySQL log: %s %s",
__mysql_last_time, p);
}
__mysql_last_time, p);
}
-
-
+
+
/* Multiple events at the same second share the same
* time stamp.
* 0909 2020 2020 2020 20
/* Multiple events at the same second share the same
* time stamp.
* 0909 2020 2020 2020 20
@@
-142,20
+143,20
@@
void *read_mysql_log(int pos, int *rc, int drop_it)
{
p++;
}
{
p++;
}
-
- /* Valid MySQL message */
- snprintf(buffer, OS_MAXSTR, "MySQL log: %s %s",
- __mysql_last_time, p);
+
+ /* Valid MySQL message */
+ snprintf(buffer, OS_MAXSTR, "MySQL log: %s %s",
+ __mysql_last_time, p);
}
else
{
continue;
}
}
else
{
continue;
}
-
-
+
+
debug2("%s: DEBUG: Reading mysql messages: '%s'", ARGV0, buffer);
debug2("%s: DEBUG: Reading mysql messages: '%s'", ARGV0, buffer);
-
+
/* Sending message to queue */
if(drop_it == 0)
{
/* Sending message to queue */
if(drop_it == 0)
{
@@
-168,11
+169,11
@@
void *read_mysql_log(int pos, int *rc, int drop_it)
}
}
}
}
}
}
-
+
continue;
}
continue;
}
- return(NULL);
+ return(NULL);
}
/* EOF */
}
/* EOF */