Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
02a0ebc6
Commit
02a0ebc6
authored
Jul 06, 2019
by
HF
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make Win compiler happy about the SERVER_AUDIT code.
parent
d04961cd
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
24 deletions
+24
-24
plugin/server_audit/server_audit.c
plugin/server_audit/server_audit.c
+21
-21
plugin/server_audit/test_audit_v4.c
plugin/server_audit/test_audit_v4.c
+3
-3
No files found.
plugin/server_audit/server_audit.c
View file @
02a0ebc6
...
...
@@ -28,7 +28,11 @@
#ifndef _WIN32
#define DO_SYSLOG
#include <syslog.h>
static
const
char
out_type_desc
[]
=
"Desired output type. Possible values - 'syslog', 'file'"
" or 'null' as no output."
;
#else
static
const
char
out_type_desc
[]
=
"Desired output type. Possible values - 'file'"
" or 'null' as no output."
;
#define syslog(PRIORITY, FORMAT, INFO, MESSAGE_LEN, MESSAGE) do {}while(0)
static
void
closelog
()
{}
#define openlog(IDENT, LOG_NOWAIT, LOG_USER) do {}while(0)
...
...
@@ -88,6 +92,7 @@ static void closelog() {}
#include <typelib.h>
#include <mysql/plugin.h>
#include <mysql/plugin_audit.h>
#include "../../mysys/mysys_priv.h"
#ifndef RTLD_DEFAULT
#define RTLD_DEFAULT NULL
#endif
...
...
@@ -405,13 +410,7 @@ static TYPELIB output_typelib=
output_type_names
,
NULL
};
static
MYSQL_SYSVAR_ENUM
(
output_type
,
output_type
,
PLUGIN_VAR_RQCMDARG
,
#ifdef DO_SYSLOG
"Desired output type. Possible values - 'syslog', 'file'"
" or 'null' as no output."
,
#else
"Desired output type. Possible values - 'file'"
" or 'null' as no output."
,
#endif
out_type_desc
,
0
,
update_output_type
,
OUTPUT_FILE
,
&
output_typelib
);
static
MYSQL_SYSVAR_STR
(
file_path
,
file_path
,
PLUGIN_VAR_RQCMDARG
,
...
...
@@ -655,7 +654,7 @@ static void remove_blanks(char *user)
struct
user_name
{
in
t
name_len
;
size_
t
name_len
;
char
*
name
;
};
...
...
@@ -690,7 +689,7 @@ static int cmp_users(const void *ia, const void *ib)
{
const
struct
user_name
*
a
=
(
const
struct
user_name
*
)
ia
;
const
struct
user_name
*
b
=
(
const
struct
user_name
*
)
ib
;
int
dl
=
a
->
name_len
-
b
->
name_len
;
int
dl
=
(
int
)
a
->
name_len
-
(
int
)
b
->
name_len
;
if
(
dl
!=
0
)
return
dl
;
...
...
@@ -698,7 +697,7 @@ static int cmp_users(const void *ia, const void *ib)
}
static
char
*
coll_search
(
struct
user_coll
*
c
,
const
char
*
n
,
in
t
len
)
static
char
*
coll_search
(
struct
user_coll
*
c
,
const
char
*
n
,
size_
t
len
)
{
struct
user_name
un
;
struct
user_name
*
found
;
...
...
@@ -710,7 +709,7 @@ static char *coll_search(struct user_coll *c, const char *n, int len)
}
static
int
coll_insert
(
struct
user_coll
*
c
,
char
*
n
,
in
t
len
)
static
int
coll_insert
(
struct
user_coll
*
c
,
char
*
n
,
size_
t
len
)
{
if
(
c
->
n_users
>=
c
->
n_alloced
)
{
...
...
@@ -965,7 +964,7 @@ static void get_str_n(char *dest, int *dest_len, size_t dest_size,
memcpy
(
dest
,
src
,
src_len
);
dest
[
src_len
]
=
0
;
*
dest_len
=
src_len
;
*
dest_len
=
(
int
)
src_len
;
}
...
...
@@ -1151,6 +1150,7 @@ static void setup_connection_connect(struct connection_info *cn,
#define SAFE_STRLEN(s) (s ? strlen(s) : 0)
#define SAFE_STRLEN_UI(s) ((unsigned int) (s ? strlen(s) : 0))
static
char
empty_str
[
1
]
=
{
0
};
...
...
@@ -1310,7 +1310,7 @@ static int write_log(const char *message, size_t len, int take_lock)
static
size_t
log_header
(
char
*
message
,
size_t
message_len
,
time_t
*
ts
,
const
char
*
serverhost
,
unsigned
in
t
serverhost_len
,
const
char
*
serverhost
,
size_
t
serverhost_len
,
const
char
*
username
,
unsigned
int
username_len
,
const
char
*
host
,
unsigned
int
host_len
,
const
char
*
userip
,
unsigned
int
userip_len
,
...
...
@@ -1328,7 +1328,7 @@ static size_t log_header(char *message, size_t message_len,
if
(
output_type
==
OUTPUT_SYSLOG
)
return
my_snprintf
(
message
,
message_len
,
"%.*s,%.*s,%.*s,%d,%lld,%s"
,
serverhost_len
,
serverhost
,
(
unsigned
int
)
serverhost_len
,
serverhost
,
username_len
,
username
,
host_len
,
host
,
connection_id
,
query_id
,
operation
);
...
...
@@ -1486,7 +1486,7 @@ static size_t escape_string_hide_passwords(const char *str, unsigned int len,
}
next_s
++
;
}
len
-=
next_s
-
str
;
len
-=
(
unsigned
int
)
(
next_s
-
str
)
;
str
=
next_s
;
continue
;
}
...
...
@@ -1807,9 +1807,9 @@ static int log_table(const struct connection_info *cn,
(
void
)
time
(
&
ctime
);
csize
=
log_header
(
message
,
sizeof
(
message
)
-
1
,
&
ctime
,
servhost
,
servhost_len
,
event
->
user
,
SAFE_STRLEN
(
event
->
user
),
event
->
host
,
SAFE_STRLEN
(
event
->
host
),
event
->
ip
,
SAFE_STRLEN
(
event
->
ip
),
event
->
user
,
SAFE_STRLEN
_UI
(
event
->
user
),
event
->
host
,
SAFE_STRLEN
_UI
(
event
->
host
),
event
->
ip
,
SAFE_STRLEN
_UI
(
event
->
ip
),
event
->
thread_id
,
cn
->
query_id
,
type
);
csize
+=
my_snprintf
(
message
+
csize
,
sizeof
(
message
)
-
1
-
csize
,
",%.*s,%.*s,"
,
event
->
database_length
,
event
->
database
,
...
...
@@ -1829,9 +1829,9 @@ static int log_rename(const struct connection_info *cn,
(
void
)
time
(
&
ctime
);
csize
=
log_header
(
message
,
sizeof
(
message
)
-
1
,
&
ctime
,
servhost
,
servhost_len
,
event
->
user
,
SAFE_STRLEN
(
event
->
user
),
event
->
host
,
SAFE_STRLEN
(
event
->
host
),
event
->
ip
,
SAFE_STRLEN
(
event
->
ip
),
event
->
user
,
SAFE_STRLEN
_UI
(
event
->
user
),
event
->
host
,
SAFE_STRLEN
_UI
(
event
->
host
),
event
->
ip
,
SAFE_STRLEN
_UI
(
event
->
ip
),
event
->
thread_id
,
cn
->
query_id
,
"RENAME"
);
csize
+=
my_snprintf
(
message
+
csize
,
sizeof
(
message
)
-
1
-
csize
,
",%.*s,%.*s|%.*s.%.*s,"
,
event
->
database_length
,
event
->
database
,
...
...
plugin/server_audit/test_audit_v4.c
View file @
02a0ebc6
...
...
@@ -56,11 +56,11 @@ static int auditing_v4(MYSQL_THD thd, mysql_event_class_t class, const void *ev)
ev_302
.
general_error_code
=
event
->
general_error_code
;
ev_302
.
general_thread_id
=
event
->
general_thread_id
;
ev_302
.
general_user
=
event
->
general_user
.
str
;
ev_302
.
general_user_length
=
event
->
general_user
.
length
;
ev_302
.
general_user_length
=
(
unsigned
int
)
event
->
general_user
.
length
;
ev_302
.
general_command
=
event
->
general_command
.
str
;
ev_302
.
general_command_length
=
event
->
general_command
.
length
;
ev_302
.
general_command_length
=
(
unsigned
int
)
event
->
general_command
.
length
;
ev_302
.
general_query
=
event
->
general_query
.
str
;
ev_302
.
general_query_length
=
event
->
general_query
.
length
;
ev_302
.
general_query_length
=
(
unsigned
int
)
event
->
general_query
.
length
;
ev_302
.
general_charset
=
event
->
general_charset
;
ev_302
.
general_time
=
event
->
general_time
;
ev_302
.
general_rows
=
event
->
general_rows
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment