summaryrefslogtreecommitdiff
path: root/plugin/server_audit
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2017-03-30 12:48:42 +0200
committerSergei Golubchik <serg@mariadb.org>2017-03-30 12:48:42 +0200
commitda4d71d10d23c1ac2d10b72baee14991ccb7a146 (patch)
tree7cdf3a8c8e72ca7c1c8105427c04123f025bd870 /plugin/server_audit
parent9ec85009985d644ce7ae797bc3572d0ad0f69bb0 (diff)
parenta00517ac9707ffd51c092f5af5d198c5ee789bb4 (diff)
downloadmariadb-git-da4d71d10d23c1ac2d10b72baee14991ccb7a146.tar.gz
Merge branch '10.1' into 10.2
Diffstat (limited to 'plugin/server_audit')
-rw-r--r--plugin/server_audit/CMakeLists.txt2
-rw-r--r--plugin/server_audit/plugin_audit_v4.h2
-rw-r--r--plugin/server_audit/server_audit.c38
3 files changed, 26 insertions, 16 deletions
diff --git a/plugin/server_audit/CMakeLists.txt b/plugin/server_audit/CMakeLists.txt
index 3de8c43c871..2c9964543bf 100644
--- a/plugin/server_audit/CMakeLists.txt
+++ b/plugin/server_audit/CMakeLists.txt
@@ -11,7 +11,7 @@
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
SET(SERVER_AUDIT_SOURCES
server_audit.c test_audit_v4.c plugin_audit_v4.h)
diff --git a/plugin/server_audit/plugin_audit_v4.h b/plugin/server_audit/plugin_audit_v4.h
index 5f8e43b3811..f8662c23e6b 100644
--- a/plugin/server_audit/plugin_audit_v4.h
+++ b/plugin/server_audit/plugin_audit_v4.h
@@ -232,7 +232,7 @@ struct mysql_event_parse
/** input: the original query text */
MYSQL_LEX_CSTRING query;
- /** output: returns the null-terminated rewriten query allocated by my_malloc() */
+ /** output: returns the null-terminated rewritten query allocated by my_malloc() */
MYSQL_LEX_CSTRING *rewritten_query;
};
diff --git a/plugin/server_audit/server_audit.c b/plugin/server_audit/server_audit.c
index 95b9586a1c5..c0ec9aa6b8d 100644
--- a/plugin/server_audit/server_audit.c
+++ b/plugin/server_audit/server_audit.c
@@ -11,11 +11,11 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#define PLUGIN_VERSION 0x104
-#define PLUGIN_STR_VERSION "1.4.0"
+#define PLUGIN_STR_VERSION "1.4.1"
#define _my_thread_var loc_thread_var
@@ -156,10 +156,8 @@ static File loc_open(const char *FileName, int Flags)
File fd;
#if defined(_WIN32)
fd= my_win_open(FileName, Flags);
-#elif !defined(NO_OPEN_3)
- fd = open(FileName, Flags, my_umask); /* Normal unix */
#else
- fd = open((char *) FileName, Flags);
+ fd = open(FileName, Flags, my_umask);
#endif
my_errno= errno;
return fd;
@@ -2295,10 +2293,10 @@ typedef struct loc_system_variables
} LOC_SV;
+static int init_done= 0;
+
static int server_audit_init(void *p __attribute__((unused)))
{
- const void *my_hash_init_ptr;
-
if (!serv_ver)
{
#ifdef _WIN32
@@ -2307,11 +2305,16 @@ static int server_audit_init(void *p __attribute__((unused)))
serv_ver= server_version;
#endif /*_WIN32*/
}
- my_hash_init_ptr= dlsym(RTLD_DEFAULT, "_my_hash_init");
- if (!my_hash_init_ptr)
+ if (!mysql_57_started)
{
- maria_above_5= 1;
- my_hash_init_ptr= dlsym(RTLD_DEFAULT, "my_hash_init2");
+ const void *my_hash_init_ptr= dlsym(RTLD_DEFAULT, "_my_hash_init");
+ if (!my_hash_init_ptr)
+ {
+ maria_above_5= 1;
+ my_hash_init_ptr= dlsym(RTLD_DEFAULT, "my_hash_init2");
+ }
+ if (!my_hash_init_ptr)
+ return 1;
}
if(!(int_mysql_data_home= dlsym(RTLD_DEFAULT, "mysql_data_home")))
@@ -2320,7 +2323,7 @@ static int server_audit_init(void *p __attribute__((unused)))
int_mysql_data_home= &default_home;
}
- if (!serv_ver || !my_hash_init_ptr)
+ if (!serv_ver)
return 1;
if (!started_mysql)
@@ -2400,6 +2403,7 @@ static int server_audit_init(void *p __attribute__((unused)))
if (logging)
start_logging();
+ init_done= 1;
return 0;
}
@@ -2415,6 +2419,10 @@ static int server_audit_init_mysql(void *p)
static int server_audit_deinit(void *p __attribute__((unused)))
{
+ if (!init_done)
+ return 0;
+
+ init_done= 0;
coll_free(&incl_user_coll);
coll_free(&excl_user_coll);
@@ -2837,13 +2845,15 @@ void __attribute__ ((constructor)) audit_plugin_so_init(void)
if (sc >= 24)
use_event_data_for_disconnect= 1;
}
- else if (serv_ver[0] == '5' && serv_ver[2] == '7')
+ else if ((serv_ver[0] == '5' && serv_ver[2] == '7') ||
+ (serv_ver[0] == '8' && serv_ver[2] == '0'))
{
mysql_57_started= 1;
_mysql_plugin_declarations_[0].info= mysql_v4_descriptor;
use_event_data_for_disconnect= 1;
}
- MYSQL_SYSVAR_NAME(loc_info).flags= PLUGIN_VAR_READONLY | PLUGIN_VAR_MEMALLOC;
+ MYSQL_SYSVAR_NAME(loc_info).flags= PLUGIN_VAR_STR | PLUGIN_VAR_THDLOCAL |
+ PLUGIN_VAR_READONLY | PLUGIN_VAR_MEMALLOC;
}
memset(locinfo_ini_value, 'O', sizeof(locinfo_ini_value)-1);